@expo/cli 0.17.9 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +11 -7
- package/build/bin/cli.map +1 -1
- package/build/src/api/getExpoSchema.js +23 -5
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/graphql/client.js +28 -10
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +16 -4
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +8 -2
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +8 -2
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemCache.js +21 -9
- package/build/src/api/rest/cache/FileSystemCache.js.map +1 -1
- package/build/src/api/rest/cache/response.js +9 -3
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +32 -8
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +23 -5
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js +9 -4
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +8 -2
- package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
- package/build/src/api/settings.js +8 -2
- package/build/src/api/settings.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +18 -6
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +26 -8
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +17 -5
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +32 -8
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +17 -5
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +19 -12
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +25 -7
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +9 -3
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js +8 -2
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +16 -4
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js +10 -4
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/templates.js +33 -9
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js +8 -2
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +8 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +58 -18
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +17 -5
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +8 -2
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +16 -4
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +32 -12
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +27 -9
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +10 -2
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +29 -17
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +69 -37
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +33 -9
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +61 -16
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js +8 -2
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js +15 -3
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/index.js +11 -5
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +9 -3
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +27 -15
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +18 -6
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +8 -2
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +43 -19
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +16 -4
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +9 -3
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/install/applyPlugins.js +8 -2
- package/build/src/install/applyPlugins.js.map +1 -1
- package/build/src/install/checkPackages.js +18 -6
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +8 -2
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js +14 -8
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +27 -9
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +17 -5
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +17 -5
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/log.js +9 -3
- package/build/src/log.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +37 -13
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +16 -4
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +29 -11
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js +24 -6
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +14 -8
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -3
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +119 -0
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -0
- package/build/src/prebuild/resolveOptions.js +32 -8
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +44 -14
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +18 -2
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -13
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +16 -4
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/run/android/index.js +20 -4
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +55 -0
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -0
- package/build/src/run/android/resolveInstallApkName.js +18 -6
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +10 -4
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +5 -3
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +13 -4
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +15 -3
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +10 -4
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +8 -2
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +57 -21
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +25 -7
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +10 -4
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +34 -10
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +16 -4
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +8 -2
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +17 -5
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +17 -5
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +25 -7
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +24 -6
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +8 -2
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +8 -2
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +17 -5
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +8 -2
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +9 -3
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js +25 -7
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +22 -10
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +19 -7
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +17 -5
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +9 -3
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +1 -2
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +27 -9
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js +8 -2
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +10 -2
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/startBundler.js +16 -4
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/detectDevClient.js +29 -0
- package/build/src/start/detectDevClient.js.map +1 -0
- package/build/src/start/doctor/SecurityBinPrerequisite.js +8 -2
- package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +16 -4
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +16 -4
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +79 -29
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcrunPrerequisite.js +24 -6
- package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +25 -7
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +27 -9
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +24 -6
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +8 -2
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +25 -7
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +32 -21
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +33 -9
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +18 -6
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +29 -11
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +18 -6
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +17 -11
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +27 -9
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +17 -11
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +8 -2
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +9 -3
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js +8 -2
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +30 -14
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +33 -13
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +17 -5
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js +13 -7
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +19 -7
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +34 -10
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js +16 -4
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +21 -4
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +32 -8
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +23 -6
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +10 -4
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js +26 -8
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +50 -18
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/assertSystemRequirements.js +4 -3
- package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +16 -4
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +8 -2
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +9 -3
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +12 -6
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +40 -10
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +16 -4
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/dotExpo.js +27 -9
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/resolveOptions.js +33 -15
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +34 -10
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +16 -4
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +28 -10
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +16 -4
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +9 -3
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/ReactDevToolsProxy.js +26 -8
- package/build/src/start/server/ReactDevToolsProxy.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +19 -6
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +91 -55
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +231 -83
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +30 -15
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +26 -8
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +56 -20
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +90 -45
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +29 -28
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/MessageHandler.js +27 -0
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +11 -8
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +63 -0
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers/utils.js → getDebuggerType.js} +1 -6
- package/build/src/start/server/metro/debugging/getDebuggerType.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/NetworkResponse.js +8 -5
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/PageReload.js +7 -6
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js +25 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js +22 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js +28 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/VscodeRuntimeGetProperties.js +10 -6
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/pageIsSupported.js +14 -0
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -0
- package/build/src/start/server/metro/debugging/types.js.map +1 -0
- package/build/src/start/server/metro/externals.js +51 -64
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +8 -2
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +8 -2
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +34 -10
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +96 -30
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +40 -21
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroVirtualModules.js +82 -0
- package/build/src/start/server/metro/metroVirtualModules.js.map +1 -0
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +8 -2
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/router.js +44 -17
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +56 -14
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +25 -12
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +8 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +148 -46
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +31 -13
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js +22 -10
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +16 -4
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +42 -12
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +8 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +41 -11
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +40 -10
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js +24 -6
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +8 -2
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +24 -6
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +25 -8
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +10 -4
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +24 -6
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +33 -9
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +27 -11
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +33 -9
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +12 -2
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/resolveAssets.js +17 -5
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +8 -2
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +8 -2
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +37 -13
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +16 -4
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +91 -37
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +27 -9
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +27 -9
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +26 -8
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +36 -12
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +17 -5
- package/build/src/start/server/webpack/compile.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +8 -2
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +35 -11
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +36 -11
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +32 -8
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/getDevClientProperties.js +26 -8
- package/build/src/utils/analytics/getDevClientProperties.js.map +1 -1
- package/build/src/utils/analytics/metroDebuggerMiddleware.js +2 -2
- package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
- package/build/src/utils/args.js +32 -8
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +64 -28
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +79 -29
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +24 -69
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/dir.js +33 -26
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +40 -10
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +26 -11
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +18 -6
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +40 -31
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +20 -5
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/findUp.js +18 -6
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +19 -7
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +18 -6
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +18 -6
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +9 -3
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/ip.js +8 -2
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/isModuleSymlinked.js +16 -4
- package/build/src/utils/isModuleSymlinked.js.map +1 -1
- package/build/src/utils/link.js +18 -6
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +25 -13
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +18 -6
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/modifyConfigPlugins.js +8 -2
- package/build/src/utils/modifyConfigPlugins.js.map +1 -1
- package/build/src/utils/nodeEnv.js +2 -0
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/nodeModules.js +23 -5
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +64 -17
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/open.js +9 -3
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +16 -4
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +24 -6
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +22 -10
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/profile.js +8 -2
- package/build/src/utils/profile.js.map +1 -1
- package/build/src/utils/progress.js +8 -2
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +16 -4
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/scheme.js +75 -23
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/tar.js +16 -4
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/DetachedClient.js +87 -0
- package/build/src/utils/telemetry/DetachedClient.js.map +1 -0
- package/build/src/utils/telemetry/RudderClient.js +98 -0
- package/build/src/utils/telemetry/RudderClient.js.map +1 -0
- package/build/src/utils/telemetry/flushDetached.js +43 -0
- package/build/src/utils/telemetry/flushDetached.js.map +1 -0
- package/build/src/utils/telemetry/getContext.js +92 -0
- package/build/src/utils/telemetry/getContext.js.map +1 -0
- package/build/src/utils/telemetry/index.js +32 -0
- package/build/src/utils/telemetry/index.js.map +1 -0
- package/build/src/utils/telemetry/types.js +6 -0
- package/build/src/utils/telemetry/types.js.map +1 -0
- package/build/src/utils/tsconfig/evaluateTsConfig.js +16 -4
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +18 -6
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +10 -4
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/build/src/utils/url.js +19 -10
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +18 -6
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/whoami/whoamiAsync.js +8 -2
- package/build/src/whoami/whoamiAsync.js.map +1 -1
- package/package.json +15 -16
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +27907 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +9494 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +10015 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +28375 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +9714 -0
- package/build/src/run/android/resolveGradleProps.js +0 -37
- package/build/src/run/android/resolveGradleProps.js.map +0 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +0 -52
- package/build/src/start/server/metro/bundleApiRoutes.js.map +0 -1
- package/build/src/start/server/metro/debugging/InspectorDevice.js +0 -80
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +0 -1
- package/build/src/start/server/metro/debugging/InspectorProxy.js +0 -116
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js +0 -21
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js +0 -56
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js +0 -18
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js +0 -24
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js +0 -38
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js +0 -38
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +0 -184
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +0 -1
- package/build/src/utils/analytics/rudderstackClient.js +0 -147
- package/build/src/utils/analytics/rudderstackClient.js.map +0 -1
- /package/build/src/start/server/metro/debugging/{inspectorHandlers/types.js → types.js} +0 -0
|
@@ -5,8 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.getPID = getPID;
|
|
6
6
|
exports.getDirectoryOfProcessById = getDirectoryOfProcessById;
|
|
7
7
|
exports.getRunningProcess = getRunningProcess;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function _childProcess() {
|
|
9
|
+
const data = require("child_process");
|
|
10
|
+
_childProcess = function() {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function path() {
|
|
16
|
+
const data = _interopRequireWildcard(require("path"));
|
|
17
|
+
path = function() {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
10
22
|
function _interopRequireWildcard(obj) {
|
|
11
23
|
if (obj && obj.__esModule) {
|
|
12
24
|
return obj;
|
|
@@ -39,7 +51,7 @@ const defaultOptions = {
|
|
|
39
51
|
};
|
|
40
52
|
function getPID(port) {
|
|
41
53
|
try {
|
|
42
|
-
const results = (
|
|
54
|
+
const results = _childProcess().execFileSync("lsof", [
|
|
43
55
|
`-i:${port}`,
|
|
44
56
|
"-P",
|
|
45
57
|
"-t",
|
|
@@ -54,7 +66,7 @@ function getPID(port) {
|
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
/** Get `package.json` `name` field for a given directory. Returns `null` if none exist. */ function getPackageName(packageRoot) {
|
|
57
|
-
const packageJson = path.join(packageRoot, "package.json");
|
|
69
|
+
const packageJson = path().join(packageRoot, "package.json");
|
|
58
70
|
try {
|
|
59
71
|
return require(packageJson).name || null;
|
|
60
72
|
} catch {
|
|
@@ -66,10 +78,10 @@ function getPID(port) {
|
|
|
66
78
|
if (name) {
|
|
67
79
|
return name;
|
|
68
80
|
}
|
|
69
|
-
return (
|
|
81
|
+
return _childProcess().execSync(`ps -o command -p ${pid} | sed -n 2p`, defaultOptions).replace(/\n$/, "").trim();
|
|
70
82
|
}
|
|
71
83
|
function getDirectoryOfProcessById(processId) {
|
|
72
|
-
return (
|
|
84
|
+
return _childProcess().execSync(`lsof -p ${processId} | awk '$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}'`, defaultOptions).trim();
|
|
73
85
|
}
|
|
74
86
|
function getRunningProcess(port) {
|
|
75
87
|
// 63828
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import { execFileSync, execSync, ExecSyncOptionsWithStringEncoding } from 'child_process';\nimport * as path from 'path';\n\nconst debug = require('debug')('expo:utils:getRunningProcess') as typeof console.log;\n\nconst defaultOptions: ExecSyncOptionsWithStringEncoding = {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n};\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport function getPID(port: number): number | null {\n try {\n const results = execFileSync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], defaultOptions)\n .split('\\n')[0]\n .trim();\n const pid = Number(results);\n debug(`pid: ${pid} for port: ${port}`);\n return pid;\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 const packageJson = path.join(packageRoot, 'package.json');\n try {\n return require(packageJson).name || null;\n } catch {\n return null;\n }\n}\n\n/** Returns a command like `node /Users/evanbacon/.../bin/expo start` or the package.json name. */\nfunction getProcessCommand(pid: number, procDirectory: string): string {\n const name = getPackageName(procDirectory);\n\n if (name) {\n return name;\n }\n return execSync(`ps -o command -p ${pid} | sed -n 2p`, defaultOptions).replace(/\\n$/, '').trim();\n}\n\n/** Get directory for a given process ID. */\nexport function getDirectoryOfProcessById(processId: number): string {\n return execSync(\n `lsof -p ${processId} | awk '$4==\"cwd\" {for (i=9; i<=NF; i++) printf \"%s \", $i}'`,\n defaultOptions\n ).trim();\n}\n\n/** Get information about a running process given a port. Returns null if no process is running on the given port. */\nexport function getRunningProcess(port: number): {\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} | null {\n // 63828\n const pid = getPID(port);\n if (!pid) {\n return null;\n }\n\n try {\n // /Users/evanbacon/Documents/GitHub/lab/myapp\n const directory = getDirectoryOfProcessById(pid);\n // /Users/evanbacon/Documents/GitHub/lab/myapp/package.json\n const command = getProcessCommand(pid, directory);\n // TODO: Have a better message for reusing another process.\n return { pid, directory, command };\n } catch {\n return null;\n }\n}\n"],"names":["getPID","getDirectoryOfProcessById","getRunningProcess","path","debug","require","defaultOptions","encoding","stdio","port","results","execFileSync","split","trim","pid","Number","error","getPackageName","packageRoot","packageJson","join","name","getProcessCommand","procDirectory","execSync","replace","processId","directory","command"],"mappings":"AAAA;;;;QAWgBA,MAAM,GAANA,MAAM;QAmCNC,yBAAyB,GAAzBA,yBAAyB;QAQzBC,iBAAiB,GAAjBA,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import { execFileSync, execSync, ExecSyncOptionsWithStringEncoding } from 'child_process';\nimport * as path from 'path';\n\nconst debug = require('debug')('expo:utils:getRunningProcess') as typeof console.log;\n\nconst defaultOptions: ExecSyncOptionsWithStringEncoding = {\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'ignore'],\n};\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport function getPID(port: number): number | null {\n try {\n const results = execFileSync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], defaultOptions)\n .split('\\n')[0]\n .trim();\n const pid = Number(results);\n debug(`pid: ${pid} for port: ${port}`);\n return pid;\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 const packageJson = path.join(packageRoot, 'package.json');\n try {\n return require(packageJson).name || null;\n } catch {\n return null;\n }\n}\n\n/** Returns a command like `node /Users/evanbacon/.../bin/expo start` or the package.json name. */\nfunction getProcessCommand(pid: number, procDirectory: string): string {\n const name = getPackageName(procDirectory);\n\n if (name) {\n return name;\n }\n return execSync(`ps -o command -p ${pid} | sed -n 2p`, defaultOptions).replace(/\\n$/, '').trim();\n}\n\n/** Get directory for a given process ID. */\nexport function getDirectoryOfProcessById(processId: number): string {\n return execSync(\n `lsof -p ${processId} | awk '$4==\"cwd\" {for (i=9; i<=NF; i++) printf \"%s \", $i}'`,\n defaultOptions\n ).trim();\n}\n\n/** Get information about a running process given a port. Returns null if no process is running on the given port. */\nexport function getRunningProcess(port: number): {\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} | null {\n // 63828\n const pid = getPID(port);\n if (!pid) {\n return null;\n }\n\n try {\n // /Users/evanbacon/Documents/GitHub/lab/myapp\n const directory = getDirectoryOfProcessById(pid);\n // /Users/evanbacon/Documents/GitHub/lab/myapp/package.json\n const command = getProcessCommand(pid, directory);\n // TODO: Have a better message for reusing another process.\n return { pid, directory, command };\n } catch {\n return null;\n }\n}\n"],"names":["getPID","getDirectoryOfProcessById","getRunningProcess","path","debug","require","defaultOptions","encoding","stdio","port","results","execFileSync","split","trim","pid","Number","error","getPackageName","packageRoot","packageJson","join","name","getProcessCommand","procDirectory","execSync","replace","processId","directory","command"],"mappings":"AAAA;;;;QAWgBA,MAAM,GAANA,MAAM;QAmCNC,yBAAyB,GAAzBA,yBAAyB;QAQzBC,iBAAiB,GAAjBA,iBAAiB;SAtDyC,aAAe;yBAAf,eAAe;IAAf,aAAe;;;;;SAC7EC,IAAI;iDAAM,MAAM;IAAhBA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAC,AAAsB,AAAC;AAErF,MAAMC,cAAc,GAAsC;IACxDC,QAAQ,EAAE,MAAM;IAChBC,KAAK,EAAE;QAAC,MAAM;QAAE,MAAM;QAA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AAI,EAAE,CAAC;CAClG;AAGM,SAASZ,yBAAyB,CAACyB,SAAiB,EAAU;IACnE,OAAOF,aAAQ,WAAA,CACb,CAAC,QAAQ,EAAEE,SAAS,CAAC,2DAA2D,CAAC,EACjFpB,cAAc,CACf,CAACO,IAAI,EAAE,CAAC;CACV;AAGM,SAASX,iBAAiB,CAACO,IAAY,EAOrC;IACP,QAAQ;IACR,MAAMK,GAAG,GAAGd,MAAM,CAACS,IAAI,CAAC,AAAC;IACzB,IAAI,CAACK,GAAG,EAAE;QACR,OAAO,IAAI,CAAC;KACb;IAED,IAAI;QACF,8CAA8C;QAC9C,MAAMa,SAAS,GAAG1B,yBAAyB,CAACa,GAAG,CAAC,AAAC;QACjD,2DAA2D;QAC3D,MAAMc,OAAO,GAAGN,iBAAiB,CAACR,GAAG,EAAEa,SAAS,CAAC,AAAC;QAClD,2DAA2D;QAC3D,OAAO;YAAEb,GAAG;YAAEa,SAAS;YAAEC,OAAO;SAAE,CAAC;KACpC,CAAC,OAAM;QACN,OAAO,IAAI,CAAC;KACb;CACF"}
|
package/build/src/utils/git.js
CHANGED
|
@@ -4,8 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.maybeBailOnGitStatusAsync = maybeBailOnGitStatusAsync;
|
|
6
6
|
exports.validateGitStatusAsync = validateGitStatusAsync;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function _spawnAsync() {
|
|
8
|
+
const data = _interopRequireDefault(require("@expo/spawn-async"));
|
|
9
|
+
_spawnAsync = function() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _chalk() {
|
|
15
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
16
|
+
_chalk = function() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
9
21
|
var _env = require("./env");
|
|
10
22
|
var _interactive = require("./interactive");
|
|
11
23
|
var _prompts = require("./prompts");
|
|
@@ -62,7 +74,7 @@ async function maybeBailOnGitStatusAsync() {
|
|
|
62
74
|
async function validateGitStatusAsync() {
|
|
63
75
|
let workingTreeStatus = "unknown";
|
|
64
76
|
try {
|
|
65
|
-
const result = await (
|
|
77
|
+
const result = await _spawnAsync().default("git", [
|
|
66
78
|
"status",
|
|
67
79
|
"--porcelain"
|
|
68
80
|
]);
|
|
@@ -72,13 +84,13 @@ async function validateGitStatusAsync() {
|
|
|
72
84
|
// Maybe this project is not using git?
|
|
73
85
|
}
|
|
74
86
|
if (workingTreeStatus === "clean") {
|
|
75
|
-
Log.log(`Your git working tree is ${_chalk.default.green("clean")}`);
|
|
87
|
+
Log.log(`Your git working tree is ${_chalk().default.green("clean")}`);
|
|
76
88
|
Log.log("To revert the changes after this command completes, you can run the following:");
|
|
77
89
|
Log.log(" git clean --force && git reset --hard");
|
|
78
90
|
return true;
|
|
79
91
|
} else if (workingTreeStatus === "dirty") {
|
|
80
|
-
Log.log(`${_chalk.default.bold("Warning!")} Your git working tree is ${_chalk.default.red("dirty")}.`);
|
|
81
|
-
Log.log(`It's recommended to ${_chalk.default.bold("commit all your changes before proceeding")}, so you can revert the changes made by this command if necessary.`);
|
|
92
|
+
Log.log(`${_chalk().default.bold("Warning!")} Your git working tree is ${_chalk().default.red("dirty")}.`);
|
|
93
|
+
Log.log(`It's recommended to ${_chalk().default.bold("commit all your changes before proceeding")}, so you can revert the changes made by this command if necessary.`);
|
|
82
94
|
} else {
|
|
83
95
|
Log.log("We couldn't find a git repository in your project directory.");
|
|
84
96
|
Log.log("It's recommended to back up your project before proceeding.");
|
|
@@ -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 Log.warn(\n 'Git status is dirty but the command will continue because EXPO_NO_GIT_STATUS is enabled...'\n );\n return false;\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: `Would you like to proceed?`,\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 Log.log(`Your git working tree is ${chalk.green('clean')}`);\n Log.log('To revert the changes after this command completes, you can run the following:');\n Log.log(' git clean --force && git reset --hard');\n return true;\n } else if (workingTreeStatus === 'dirty') {\n Log.log(`${chalk.bold('Warning!')} Your git working tree is ${chalk.red('dirty')}.`);\n Log.log(\n `It's recommended to ${chalk.bold(\n 'commit all your changes before proceeding'\n )}, so you can revert the changes made by this command if necessary.`\n );\n } else {\n Log.log(\"We couldn't find a git repository in your project directory.\");\n Log.log(\"It's recommended to back up your project before proceeding.\");\n }\n\n return false;\n}\n"],"names":["maybeBailOnGitStatusAsync","validateGitStatusAsync","Log","env","EXPO_NO_GIT_STATUS","warn","isGitStatusClean","isInteractive","log","answer","confirmAsync","message","workingTreeStatus","result","spawnAsync","stdout","chalk","green","bold","red"],"mappings":"AAAA;;;;QAQsBA,yBAAyB,GAAzBA,yBAAyB;QAgCzBC,sBAAsB,GAAtBA,sBAAsB;
|
|
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 Log.warn(\n 'Git status is dirty but the command will continue because EXPO_NO_GIT_STATUS is enabled...'\n );\n return false;\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: `Would you like to proceed?`,\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 Log.log(`Your git working tree is ${chalk.green('clean')}`);\n Log.log('To revert the changes after this command completes, you can run the following:');\n Log.log(' git clean --force && git reset --hard');\n return true;\n } else if (workingTreeStatus === 'dirty') {\n Log.log(`${chalk.bold('Warning!')} Your git working tree is ${chalk.red('dirty')}.`);\n Log.log(\n `It's recommended to ${chalk.bold(\n 'commit all your changes before proceeding'\n )}, so you can revert the changes made by this command if necessary.`\n );\n } else {\n Log.log(\"We couldn't find a git repository in your project directory.\");\n Log.log(\"It's recommended to back up your project before proceeding.\");\n }\n\n return false;\n}\n"],"names":["maybeBailOnGitStatusAsync","validateGitStatusAsync","Log","env","EXPO_NO_GIT_STATUS","warn","isGitStatusClean","isInteractive","log","answer","confirmAsync","message","workingTreeStatus","result","spawnAsync","stdout","chalk","green","bold","red"],"mappings":"AAAA;;;;QAQsBA,yBAAyB,GAAzBA,yBAAyB;QAgCzBC,sBAAsB,GAAtBA,sB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E,GAAG,OAAO,GAAG,OAAO,CAAC;KAC9D,CAAC,OAAM;IACN,8BAA8B;IAC9B,uCAAuC;KACxC;IAED,IAAIH,iBAAiB,KAAK,OAAO,EAAE;QACjCV,GAAG,CAACM,GAAG,CAAC,CAAC,yBAAyB,EAAEQ,MAAK,UAAA,CAACC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5Df,GAAG,CAACM,GAAG,CAAC,gFAAgF,CAAC,CAAC;QAC1FN,GAAG,CAACM,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;KACb,MAAM,IAAII,iBAAiB,KAAK,OAAO,EAAE;QACxCV,GAAG,CAACM,GAAG,CAAC,CAAC,EAAEQ,MAAK,UAAA,CAACE,IAAI,CAAC,UAAU,CAAC,CAAC,0BAA0B,EAAEF,MAAK,UAAA,CAACG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrFjB,GAAG,CAACM,GAAG,CACL,CAAC,oBAAoB,EAAEQ,MAAK,UAAA,CAACE,IAAI,CAC/B,2CAA2C,CAC5C,CAAC,kEAAkE,CAAC,CACtE,CAAC;KACH,MAAM;QACLhB,GAAG,CAACM,GAAG,CAAC,8DAA8D,CAAC,CAAC;QACxEN,GAAG,CAACM,GAAG,CAAC,6DAA6D,CAAC,CAAC;KACxE;IAED,OAAO,KAAK,CAAC;CACd"}
|
package/build/src/utils/glob.js
CHANGED
|
@@ -5,10 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.everyMatchAsync = everyMatchAsync;
|
|
6
6
|
exports.anyMatchAsync = anyMatchAsync;
|
|
7
7
|
exports.wrapGlobWithTimeout = wrapGlobWithTimeout;
|
|
8
|
-
|
|
8
|
+
function _glob() {
|
|
9
|
+
const data = require("glob");
|
|
10
|
+
_glob = function() {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
9
15
|
function everyMatchAsync(pattern, options) {
|
|
10
16
|
return new Promise((resolve, reject)=>{
|
|
11
|
-
const g = new _glob.Glob(pattern, options);
|
|
17
|
+
const g = new (_glob()).Glob(pattern, options);
|
|
12
18
|
let called = false;
|
|
13
19
|
const callback = (er, matched)=>{
|
|
14
20
|
if (called) return;
|
|
@@ -23,7 +29,7 @@ function everyMatchAsync(pattern, options) {
|
|
|
23
29
|
}
|
|
24
30
|
function anyMatchAsync(pattern, options) {
|
|
25
31
|
return new Promise((resolve, reject)=>{
|
|
26
|
-
const g = new _glob.Glob(pattern, options);
|
|
32
|
+
const g = new (_glob()).Glob(pattern, options);
|
|
27
33
|
let called = false;
|
|
28
34
|
const callback = (er, matched)=>{
|
|
29
35
|
if (called) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/glob.ts"],"sourcesContent":["import G, { Glob } from 'glob';\n\n/** Finds all matching files. */\nexport function everyMatchAsync(pattern: string, options: G.IOptions) {\n return new Promise<string[]>((resolve, reject) => {\n const g = new Glob(pattern, options);\n let called = false;\n const callback = (er: Error | null, matched: string[]) => {\n if (called) return;\n called = true;\n if (er) reject(er);\n else resolve(matched);\n };\n g.on('error', callback);\n g.on('end', (matches) => callback(null, matches));\n });\n}\n\n/** Bails out early after finding the first matching file. */\nexport function anyMatchAsync(pattern: string, options: G.IOptions) {\n return new Promise<string[]>((resolve, reject) => {\n const g = new Glob(pattern, options);\n let called = false;\n const callback = (er: Error | null, matched: string[]) => {\n if (called) return;\n called = true;\n if (er) reject(er);\n else resolve(matched);\n };\n g.on('error', callback);\n g.on('match', (matched) => {\n // We've disabled using abort as it breaks the entire glob package across all instances.\n // https://github.com/isaacs/node-glob/issues/279 & https://github.com/isaacs/node-glob/issues/342\n // For now, just collect every match.\n // g.abort();\n callback(null, [matched]);\n });\n g.on('end', (matches) => callback(null, matches));\n });\n}\n\n/**\n * Wait some time, then escape...\n * Adding this because glob can sometimes freeze and fail to resolve if any other glob uses `.abort()`.\n */\nexport function wrapGlobWithTimeout(\n query: () => Promise<string[]>,\n duration: number\n): Promise<string[] | false> {\n return new Promise(async (resolve, reject) => {\n const timeout = setTimeout(() => {\n resolve(false);\n }, duration);\n\n process.on('SIGINT', () => clearTimeout(timeout));\n\n try {\n resolve(await query());\n } catch (error) {\n reject(error);\n } finally {\n clearTimeout(timeout);\n }\n });\n}\n"],"names":["everyMatchAsync","anyMatchAsync","wrapGlobWithTimeout","pattern","options","Promise","resolve","reject","g","Glob","called","callback","er","matched","on","matches","query","duration","timeout","setTimeout","process","clearTimeout","error"],"mappings":"AAAA;;;;QAGgBA,eAAe,GAAfA,eAAe;QAgBfC,aAAa,GAAbA,aAAa;QA0BbC,mBAAmB,GAAnBA,mBAAmB;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/glob.ts"],"sourcesContent":["import G, { Glob } from 'glob';\n\n/** Finds all matching files. */\nexport function everyMatchAsync(pattern: string, options: G.IOptions) {\n return new Promise<string[]>((resolve, reject) => {\n const g = new Glob(pattern, options);\n let called = false;\n const callback = (er: Error | null, matched: string[]) => {\n if (called) return;\n called = true;\n if (er) reject(er);\n else resolve(matched);\n };\n g.on('error', callback);\n g.on('end', (matches) => callback(null, matches));\n });\n}\n\n/** Bails out early after finding the first matching file. */\nexport function anyMatchAsync(pattern: string, options: G.IOptions) {\n return new Promise<string[]>((resolve, reject) => {\n const g = new Glob(pattern, options);\n let called = false;\n const callback = (er: Error | null, matched: string[]) => {\n if (called) return;\n called = true;\n if (er) reject(er);\n else resolve(matched);\n };\n g.on('error', callback);\n g.on('match', (matched) => {\n // We've disabled using abort as it breaks the entire glob package across all instances.\n // https://github.com/isaacs/node-glob/issues/279 & https://github.com/isaacs/node-glob/issues/342\n // For now, just collect every match.\n // g.abort();\n callback(null, [matched]);\n });\n g.on('end', (matches) => callback(null, matches));\n });\n}\n\n/**\n * Wait some time, then escape...\n * Adding this because glob can sometimes freeze and fail to resolve if any other glob uses `.abort()`.\n */\nexport function wrapGlobWithTimeout(\n query: () => Promise<string[]>,\n duration: number\n): Promise<string[] | false> {\n return new Promise(async (resolve, reject) => {\n const timeout = setTimeout(() => {\n resolve(false);\n }, duration);\n\n process.on('SIGINT', () => clearTimeout(timeout));\n\n try {\n resolve(await query());\n } catch (error) {\n reject(error);\n } finally {\n clearTimeout(timeout);\n }\n });\n}\n"],"names":["everyMatchAsync","anyMatchAsync","wrapGlobWithTimeout","pattern","options","Promise","resolve","reject","g","Glob","called","callback","er","matched","on","matches","query","duration","timeout","setTimeout","process","clearTimeout","error"],"mappings":"AAAA;;;;QAGgBA,eAAe,GAAfA,eAAe;QAgBfC,aAAa,GAAbA,aAAa;QA0BbC,mBAAmB,GAAnBA,mBAAmB;SA7CX,KAAM;yBAAN,MAAM;IAAN,KAAM;;;;;AAGvB,SAASF,eAAe,CAACG,OAAe,EAAEC,OAAmB,EAAE;IACpE,OAAO,IAAIC,OAAO,CAAW,CAACC,OAAO,EAAEC,MAAM,GAAK;QAChD,MAAMC,CAAC,GAAG,IAAIC,CAAAA,KAAI,QAAA,CAACN,OAAO,EAAEC,OAAO,CAAC,AAAC;QACrC,IAAIM,MAAM,GAAG,KAAK,AAAC;QACnB,MAAMC,QAAQ,GAAG,CAACC,EAAgB,EAAEC,OAAiB,GAAK;YACxD,IAAIH,MAAM,EAAE,OAAO;YACnBA,MAAM,GAAG,IAAI,CAAC;YACd,IAAIE,EAAE,EAAEL,MAAM,CAACK,EAAE,CAAC,CAAC;iBACdN,OAAO,CAACO,OAAO,CAAC,CAAC;SACvB,AAAC;QACFL,CAAC,CAACM,EAAE,CAAC,OAAO,EAAEH,QAAQ,CAAC,CAAC;QACxBH,CAAC,CAACM,EAAE,CAAC,KAAK,EAAE,CAACC,OAAO,GAAKJ,QAAQ,CAAC,IAAI,EAAEI,OAAO,CAAC;QAAA,CAAC,CAAC;KACnD,CAAC,CAAC;CACJ;AAGM,SAASd,aAAa,CAACE,OAAe,EAAEC,OAAmB,EAAE;IAClE,OAAO,IAA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YACdf,MAAM,CAACe,KAAK,CAAC,CAAC;SACf,QAAS;YACRD,YAAY,CAACH,OAAO,CAAC,CAAC;SACvB;KACF,CAAC,CAAC;CACJ"}
|
package/build/src/utils/ip.js
CHANGED
|
@@ -3,14 +3,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.getIpAddress = getIpAddress;
|
|
6
|
-
|
|
6
|
+
function _internalIp() {
|
|
7
|
+
const data = _interopRequireDefault(require("internal-ip"));
|
|
8
|
+
_internalIp = function() {
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
7
13
|
function _interopRequireDefault(obj) {
|
|
8
14
|
return obj && obj.__esModule ? obj : {
|
|
9
15
|
default: obj
|
|
10
16
|
};
|
|
11
17
|
}
|
|
12
18
|
function getIpAddress() {
|
|
13
|
-
return _internalIp.default.v4.sync() || "127.0.0.1";
|
|
19
|
+
return _internalIp().default.v4.sync() || "127.0.0.1";
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
//# sourceMappingURL=ip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import internalIp from 'internal-ip';\n\nexport function getIpAddress(): string {\n return internalIp.v4.sync() || '127.0.0.1';\n}\n"],"names":["getIpAddress","internalIp","v4","sync"],"mappings":"AAAA;;;;QAEgBA,YAAY,GAAZA,YAAY;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import internalIp from 'internal-ip';\n\nexport function getIpAddress(): string {\n return internalIp.v4.sync() || '127.0.0.1';\n}\n"],"names":["getIpAddress","internalIp","v4","sync"],"mappings":"AAAA;;;;QAEgBA,YAAY,GAAZA,YAAY;SAFL,WAAa;gDAAb,aAAa;IAAb,WAAa;;;;;;;;;;AAE7B,SAASA,YAAY,GAAW;IACrC,OAAOC,WAAU,UAAA,CAACC,EAAE,CAACC,IAAI,EAAE,IAAI,WAAW,CAAC;CAC5C"}
|
|
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.isModuleSymlinked = isModuleSymlinked;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function _path() {
|
|
7
|
+
const data = _interopRequireDefault(require("path"));
|
|
8
|
+
_path = function() {
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
function _resolveFrom() {
|
|
14
|
+
const data = _interopRequireDefault(require("resolve-from"));
|
|
15
|
+
_resolveFrom = function() {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
8
20
|
function _interopRequireDefault(obj) {
|
|
9
21
|
return obj && obj.__esModule ? obj : {
|
|
10
22
|
default: obj
|
|
@@ -17,12 +29,12 @@ function _interopRequireDefault(obj) {
|
|
|
17
29
|
* isModuleRootPathInNodeModulesFolder('./foo/expo') -> false
|
|
18
30
|
* isModuleRootPathInNodeModulesFolder('./node_modules/expo') -> true
|
|
19
31
|
*/ function isModuleRootPathInNodeModulesFolder(moduleRootPath) {
|
|
20
|
-
const parentFolderName = _path.default.basename(_path.default.dirname(moduleRootPath));
|
|
32
|
+
const parentFolderName = _path().default.basename(_path().default.dirname(moduleRootPath));
|
|
21
33
|
return parentFolderName === "node_modules";
|
|
22
34
|
}
|
|
23
35
|
function isModuleSymlinked(projectRoot, { moduleId , isSilent }) {
|
|
24
36
|
try {
|
|
25
|
-
const moduleRootPath = _path.default.dirname((
|
|
37
|
+
const moduleRootPath = _path().default.dirname(_resolveFrom().default(projectRoot, `${moduleId}/package.json`));
|
|
26
38
|
return !isModuleRootPathInNodeModulesFolder(moduleRootPath);
|
|
27
39
|
} catch (error) {
|
|
28
40
|
if (!isSilent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/isModuleSymlinked.ts"],"sourcesContent":["import path from 'path';\nimport resolveFrom from 'resolve-from';\n\n/**\n * Return true if the parent folder for a given file path is named \"node_modules\".\n *\n * @example\n * isModuleRootPathInNodeModulesFolder('./foo/expo') -> false\n * isModuleRootPathInNodeModulesFolder('./node_modules/expo') -> true\n */\nfunction isModuleRootPathInNodeModulesFolder(moduleRootPath: string): boolean {\n const parentFolderName = path.basename(path.dirname(moduleRootPath));\n return parentFolderName === 'node_modules';\n}\n\n/**\n * Given a node module name, and a project path, this method will:\n *\n * 1. Resolve the module path.\n * 2. Find the module root folder.\n * 3. Return true if the module root folder is in a folder named `node_modules`\n *\n * @param projectRoot\n * @param moduleId\n *\n * @example\n * isModuleSymlinked('./expo/apps/native-component-list', {\n * moduleId: 'react-native'\n * })\n */\nexport function isModuleSymlinked(\n projectRoot: string,\n {\n moduleId,\n isSilent,\n }: {\n moduleId: string;\n isSilent?: boolean;\n }\n): boolean {\n try {\n const moduleRootPath = path.dirname(resolveFrom(projectRoot, `${moduleId}/package.json`));\n return !isModuleRootPathInNodeModulesFolder(moduleRootPath);\n } catch (error) {\n if (!isSilent) {\n throw error;\n }\n // Failed to resolve the package.json relative to the project, not sure what to do here.\n // This is probably not possible due to node module resolution.\n return false;\n }\n}\n"],"names":["isModuleSymlinked","isModuleRootPathInNodeModulesFolder","moduleRootPath","parentFolderName","path","basename","dirname","projectRoot","moduleId","isSilent","resolveFrom","error"],"mappings":"AAAA;;;;QA8BgBA,iBAAiB,GAAjBA,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/isModuleSymlinked.ts"],"sourcesContent":["import path from 'path';\nimport resolveFrom from 'resolve-from';\n\n/**\n * Return true if the parent folder for a given file path is named \"node_modules\".\n *\n * @example\n * isModuleRootPathInNodeModulesFolder('./foo/expo') -> false\n * isModuleRootPathInNodeModulesFolder('./node_modules/expo') -> true\n */\nfunction isModuleRootPathInNodeModulesFolder(moduleRootPath: string): boolean {\n const parentFolderName = path.basename(path.dirname(moduleRootPath));\n return parentFolderName === 'node_modules';\n}\n\n/**\n * Given a node module name, and a project path, this method will:\n *\n * 1. Resolve the module path.\n * 2. Find the module root folder.\n * 3. Return true if the module root folder is in a folder named `node_modules`\n *\n * @param projectRoot\n * @param moduleId\n *\n * @example\n * isModuleSymlinked('./expo/apps/native-component-list', {\n * moduleId: 'react-native'\n * })\n */\nexport function isModuleSymlinked(\n projectRoot: string,\n {\n moduleId,\n isSilent,\n }: {\n moduleId: string;\n isSilent?: boolean;\n }\n): boolean {\n try {\n const moduleRootPath = path.dirname(resolveFrom(projectRoot, `${moduleId}/package.json`));\n return !isModuleRootPathInNodeModulesFolder(moduleRootPath);\n } catch (error) {\n if (!isSilent) {\n throw error;\n }\n // Failed to resolve the package.json relative to the project, not sure what to do here.\n // This is probably not possible due to node module resolution.\n return false;\n }\n}\n"],"names":["isModuleSymlinked","isModuleRootPathInNodeModulesFolder","moduleRootPath","parentFolderName","path","basename","dirname","projectRoot","moduleId","isSilent","resolveFrom","error"],"mappings":"AAAA;;;;QA8BgBA,iBAAiB,GAAjBA,iBAAiB;SA9BhB,KAAM;gDAAN,MAAM;IAAN,KAAM;;;;;SACC,YAAc;gDAAd,cAAc;IAAd,YAAc;;;;;;;;;;AAEtC;;;;;;GAMG,CACH,SAASC,mCAAmC,CAACC,cAAsB,EAAW;IAC5E,MAAMC,gBAAgB,GAAGC,KAAI,UAAA,CAACC,QAAQ,CAACD,KAAI,UAAA,CAACE,OAAO,CAACJ,cAAc,CAAC,CAAC,AAAC;IACrE,OAAOC,gBAAgB,KAAK,cAAc,CAAC;CAC5C;AAiBM,SAASH,iBAAiB,CAC/BO,WAAmB,EACnB,EACEC,QAAQ,CAAA,EACRC,QAAQ,CAAA,EAIT,EACQ;IACT,IAAI;QACF,MAAMP,cAAc,GAAGE,KAAI,UAAA,CAACE,OAAO,CAACI,YAAW,UAAA,CAACH,WAAW,EAAE,CAAC,EAAEC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,AAAC;QAC1F,OAAO,CAACP,mCAAmC,CAACC,cAAc,CAAC,CAAC;KAC7D,CAAC,OAAOS,KAAK,EAAE;QACd,IAAI,CAACF,QAAQ,EAAE;YACb,MAAME,KAAK,CAAC;SACb;QACD,wFAAwF;QACxF,+DAA+D;QAC/D,OAAO,KAAK,CAAC;KACd;CACF"}
|
package/build/src/utils/link.js
CHANGED
|
@@ -4,8 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.link = link;
|
|
6
6
|
exports.learnMore = learnMore;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function _chalk() {
|
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
+
_chalk = function() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _terminalLink() {
|
|
15
|
+
const data = _interopRequireDefault(require("terminal-link"));
|
|
16
|
+
_terminalLink = function() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
9
21
|
function _interopRequireDefault(obj) {
|
|
10
22
|
return obj && obj.__esModule ? obj : {
|
|
11
23
|
default: obj
|
|
@@ -14,12 +26,12 @@ function _interopRequireDefault(obj) {
|
|
|
14
26
|
function link(url, { text =url , dim =true } = {}) {
|
|
15
27
|
let output;
|
|
16
28
|
// Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js
|
|
17
|
-
if (_terminalLink.default.isSupported) {
|
|
18
|
-
output = (
|
|
29
|
+
if (_terminalLink().default.isSupported) {
|
|
30
|
+
output = _terminalLink().default(text, url);
|
|
19
31
|
} else {
|
|
20
|
-
output = `${text === url ? "" : text + ": "}${_chalk.default.underline(url)}`;
|
|
32
|
+
output = `${text === url ? "" : text + ": "}${_chalk().default.underline(url)}`;
|
|
21
33
|
}
|
|
22
|
-
return dim ? _chalk.default.dim(output) : output;
|
|
34
|
+
return dim ? _chalk().default.dim(output) : output;
|
|
23
35
|
}
|
|
24
36
|
function learnMore(url, { learnMoreMessage: maybeLearnMoreMessage , dim =true } = {}) {
|
|
25
37
|
return link(url, {
|
|
@@ -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":["link","learnMore","url","text","dim","output","terminalLink","isSupported","chalk","underline","learnMoreMessage","maybeLearnMoreMessage"],"mappings":"AAAA;;;;QASgBA,IAAI,GAAJA,IAAI;QAqBJC,SAAS,GAATA,SAAS;
|
|
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":["link","learnMore","url","text","dim","output","terminalLink","isSupported","chalk","underline","learnMoreMessage","maybeLearnMoreMessage"],"mappings":"AAAA;;;;QASgBA,IAAI,GAAJA,IAAI;QAqBJC,SAAS,GAATA,SAAS;SA9BP,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;SACA,aAAe;gDAAf,eAAe;IAAf,aAAe;;;;;;;;;;AAQjC,SAASD,IAAI,CAClBE,GAAW,EACX,EAAEC,IAAI,EAAGD,GAAG,CAAA,EAAEE,GAAG,EAAG,IAAI,CAAA,EAAoC,GAAG,EAAE,EACzD;IACR,IAAIC,MAAM,AAAQ,AAAC;IACnB,mHAAmH;IACnH,IAAIC,aAAY,UAAA,CAACC,WAAW,EAAE;QAC5BF,MAAM,GAAGC,aAAY,UAAA,CAACH,IAAI,EAAED,GAAG,CAAC,CAAC;KAClC,MAAM;QACLG,MAAM,GAAG,CAAC,EAAEF,IAAI,KAAKD,GAAG,GAAG,EAAE,GAAGC,IAAI,GAAG,IAAI,CAAC,EAAEK,MAAK,UAAA,CAACC,SAAS,CAACP,GAAG,CAAC,CAAC,CAAC,CAAC;KACtE;IACD,OAAOE,GAAG,GAAGI,MAAK,UAAA,CAACJ,GAAG,CAACC,MAAM,CAAC,GAAGA,MAAM,CAAC;CACzC;AASM,SAASJ,SAAS,CACvBC,GAAW,EACX,EACEQ,gBAAgB,EAAEC,qBAAqB,CAAA,EACvCP,GAAG,EAAG,IAAI,CAAA,EACmC,GAAG,EAAE,EAC5C;IACR,OAAOJ,IAAI,CAACE,GAAG,EAAE;QAAEC,IAAI,EAAEQ,qBAAqB,WAArBA,qBAAqB,GAAI,YAAY;QAAEP,GAAG;KAAE,CAAC,CAAC;CACxE"}
|
|
@@ -11,8 +11,20 @@ exports.getSanitizedGitIgnoreLines = getSanitizedGitIgnoreLines;
|
|
|
11
11
|
exports.createGitIgnoreHash = createGitIgnoreHash;
|
|
12
12
|
exports.removeFromGitIgnore = removeFromGitIgnore;
|
|
13
13
|
exports.generatedFooterComment = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
function _crypto() {
|
|
15
|
+
const data = _interopRequireDefault(require("crypto"));
|
|
16
|
+
_crypto = function() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _fs() {
|
|
22
|
+
const data = _interopRequireDefault(require("fs"));
|
|
23
|
+
_fs = function() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
16
28
|
var _log = require("../log");
|
|
17
29
|
function _interopRequireDefault(obj) {
|
|
18
30
|
return obj && obj.__esModule ? obj : {
|
|
@@ -23,21 +35,21 @@ const generatedHeaderPrefix = `# @generated expo-cli`;
|
|
|
23
35
|
const generatedFooterComment = `# @end expo-cli`;
|
|
24
36
|
exports.generatedFooterComment = generatedFooterComment;
|
|
25
37
|
function mergeGitIgnorePaths(targetGitIgnorePath, sourceGitIgnorePath) {
|
|
26
|
-
if (!_fs.default.existsSync(targetGitIgnorePath)) {
|
|
38
|
+
if (!_fs().default.existsSync(targetGitIgnorePath)) {
|
|
27
39
|
// No gitignore in the project already, no need to merge anything into anything. I guess they
|
|
28
40
|
// are not using git :O
|
|
29
41
|
return null;
|
|
30
42
|
}
|
|
31
|
-
if (!_fs.default.existsSync(sourceGitIgnorePath)) {
|
|
43
|
+
if (!_fs().default.existsSync(sourceGitIgnorePath)) {
|
|
32
44
|
// Maybe we don't have a gitignore in the template project
|
|
33
45
|
return null;
|
|
34
46
|
}
|
|
35
|
-
const targetGitIgnore = _fs.default.readFileSync(targetGitIgnorePath).toString();
|
|
36
|
-
const sourceGitIgnore = _fs.default.readFileSync(sourceGitIgnorePath).toString();
|
|
47
|
+
const targetGitIgnore = _fs().default.readFileSync(targetGitIgnorePath).toString();
|
|
48
|
+
const sourceGitIgnore = _fs().default.readFileSync(sourceGitIgnorePath).toString();
|
|
37
49
|
const merged = mergeGitIgnoreContents(targetGitIgnore, sourceGitIgnore);
|
|
38
50
|
// Only rewrite the file if it was modified.
|
|
39
51
|
if (merged.contents) {
|
|
40
|
-
_fs.default.writeFileSync(targetGitIgnorePath, merged.contents);
|
|
52
|
+
_fs().default.writeFileSync(targetGitIgnorePath, merged.contents);
|
|
41
53
|
}
|
|
42
54
|
return merged;
|
|
43
55
|
}
|
|
@@ -92,7 +104,7 @@ function mergeGitIgnoreContents(targetGitIgnore, sourceGitIgnore) {
|
|
|
92
104
|
};
|
|
93
105
|
}
|
|
94
106
|
function upsertGitIgnoreContents(targetGitIgnorePath, contents) {
|
|
95
|
-
const targetGitIgnore = _fs.default.readFileSync(targetGitIgnorePath, {
|
|
107
|
+
const targetGitIgnore = _fs().default.readFileSync(targetGitIgnorePath, {
|
|
96
108
|
encoding: "utf-8",
|
|
97
109
|
flag: "a+"
|
|
98
110
|
});
|
|
@@ -106,7 +118,7 @@ function upsertGitIgnoreContents(targetGitIgnorePath, contents) {
|
|
|
106
118
|
}
|
|
107
119
|
const merged = mergeGitIgnoreContents(targetGitIgnore, contents);
|
|
108
120
|
if (merged.contents) {
|
|
109
|
-
_fs.default.writeFileSync(targetGitIgnorePath, merged.contents);
|
|
121
|
+
_fs().default.writeFileSync(targetGitIgnorePath, merged.contents);
|
|
110
122
|
}
|
|
111
123
|
return merged;
|
|
112
124
|
}
|
|
@@ -127,15 +139,15 @@ function getSanitizedGitIgnoreLines(gitIgnore) {
|
|
|
127
139
|
}
|
|
128
140
|
function createGitIgnoreHash(gitIgnore) {
|
|
129
141
|
// this doesn't need to be secure, the shorter the better.
|
|
130
|
-
const hash = _crypto.default.createHash("sha1").update(gitIgnore).digest("hex");
|
|
142
|
+
const hash = _crypto().default.createHash("sha1").update(gitIgnore).digest("hex");
|
|
131
143
|
return `sync-${hash}`;
|
|
132
144
|
}
|
|
133
145
|
function removeFromGitIgnore(targetGitIgnorePath, contents) {
|
|
134
146
|
try {
|
|
135
|
-
if (!_fs.default.existsSync(targetGitIgnorePath)) {
|
|
147
|
+
if (!_fs().default.existsSync(targetGitIgnorePath)) {
|
|
136
148
|
return;
|
|
137
149
|
}
|
|
138
|
-
let targetGitIgnore = _fs.default.readFileSync(targetGitIgnorePath, "utf-8");
|
|
150
|
+
let targetGitIgnore = _fs().default.readFileSync(targetGitIgnorePath, "utf-8");
|
|
139
151
|
if (!targetGitIgnore.includes(contents)) {
|
|
140
152
|
return null;
|
|
141
153
|
}
|
|
@@ -144,7 +156,7 @@ function removeFromGitIgnore(targetGitIgnorePath, contents) {
|
|
|
144
156
|
if (indexes.start === indexes.end - 3) {
|
|
145
157
|
targetGitIgnore = targetGitIgnore.replace(new RegExp(`^${generatedHeaderPrefix}((.|\n)*)${generatedFooterComment}$`, "m"), "");
|
|
146
158
|
}
|
|
147
|
-
return _fs.default.writeFileSync(targetGitIgnorePath, targetGitIgnore);
|
|
159
|
+
return _fs().default.writeFileSync(targetGitIgnorePath, targetGitIgnore);
|
|
148
160
|
} catch (error) {
|
|
149
161
|
_log.Log.error(`Failed to read/write to .gitignore path: ${targetGitIgnorePath}`);
|
|
150
162
|
throw error;
|
|
@@ -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":["mergeGitIgnorePaths","removeGeneratedGitIgnoreContents","mergeGitIgnoreContents","upsertGitIgnoreContents","createGeneratedHeaderComment","getSanitizedGitIgnoreLines","createGitIgnoreHash","removeFromGitIgnore","generatedHeaderPrefix","generatedFooterComment","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":"AAAA;;;;QAsBgBA,mBAAmB,GAAnBA,m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,QAAQ,CAACb,QAAQ,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;QAEDL,eAAe,GAAGA,eAAe,CAACsC,OAAO,CAAC,CAAC,EAAEjC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAE/D,MAAMqB,OAAO,GAAGnB,0BAA0B,CAACP,eAAe,CAAC,AAAC;QAE5D,IAAI0B,OAAO,CAAChB,KAAK,KAAKgB,OAAO,CAACZ,GAAG,GAAG,CAAC,EAAE;YACrCd,eAAe,GAAGA,eAAe,CAACsC,OAAO,CACvC,IAAIb,MAAM,CAAC,CAAC,CAAC,EAAE/B,qBAAqB,CAAC,SAAS,EAAEC,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAC/E,EAAE,CACH,CAAC;SACH;QAED,OAAOG,GAAE,QAAA,CAACQ,aAAa,CAACV,mBAAmB,EAAEI,eAAe,CAAC,CAAC;KAC/D,CAAC,OAAOuC,KAAK,EAAE;QACdC,IAAG,IAAA,CAACD,KAAK,CAAC,CAAC,yCAAyC,EAAE3C,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC7E,MAAM2C,KAAK,CAAC;KACb;CACF"}
|
|
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":["mergeGitIgnorePaths","removeGeneratedGitIgnoreContents","mergeGitIgnoreContents","upsertGitIgnoreContents","createGeneratedHeaderComment","getSanitizedGitIgnoreLines","createGitIgnoreHash","removeFromGitIgnore","generatedHeaderPrefix","generatedFooterComment","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":"AAAA;;;;QAsBgBA,mBAAmB,GAAnBA,mBAAmB;QAiDnBC,gCAAgC,GAAhCA,gCAAgC;QAiBhCC,sBAAsB,GAAtBA,sBAAsB;QA4BtBC,uBAAuB,GAAvBA,uBAAuB;QA4BvBC,4BAA4B,GAA5BA,4BAA4B;QAS5BC,0BAA0B,GAA1BA,0BAA0B;QAe1BC,mBAAmB,GAAnBA,mBAAmB;QAMnBC,mBAAmB,GAAnBA,mBAAmB;;SA9KhB,OAAQ;gDAAR,QAAQ;IAAR,OAAQ;;;;;SACZ,GAAI;gDAAJ,IAAI;IAAJ,GAAI;;;;;A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AGA,eAAe,CAACsC,OAAO,CACvC,IAAIb,MAAM,CAAC,CAAC,CAAC,EAAE/B,qBAAqB,CAAC,SAAS,EAAEC,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAC/E,EAAE,CACH,CAAC;SACH;QAED,OAAOG,GAAE,UAAA,CAACQ,aAAa,CAACV,mBAAmB,EAAEI,eAAe,CAAC,CAAC;KAC/D,CAAC,OAAOuC,KAAK,EAAE;QACdC,IAAG,IAAA,CAACD,KAAK,CAAC,CAAC,yCAAyC,EAAE3C,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC7E,MAAM2C,KAAK,CAAC;KACb;CACF"}
|
|
@@ -4,8 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.attemptModification = attemptModification;
|
|
6
6
|
exports.warnAboutConfigAndThrow = warnAboutConfigAndThrow;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function _config() {
|
|
8
|
+
const data = require("@expo/config");
|
|
9
|
+
_config = function() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _chalk() {
|
|
15
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
16
|
+
_chalk = function() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
9
21
|
var _errors = require("./errors");
|
|
10
22
|
var Log = _interopRequireWildcard(require("../log"));
|
|
11
23
|
function _interopRequireDefault(obj) {
|
|
@@ -35,7 +47,7 @@ function _interopRequireWildcard(obj) {
|
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
49
|
async function attemptModification(projectRoot, edits, exactEdits) {
|
|
38
|
-
const modification = await (
|
|
50
|
+
const modification = await _config().modifyConfigAsync(projectRoot, edits, {
|
|
39
51
|
skipSDKVersionRequirement: true
|
|
40
52
|
});
|
|
41
53
|
if (modification.type === "success") {
|
|
@@ -45,13 +57,13 @@ async function attemptModification(projectRoot, edits, exactEdits) {
|
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
function logNoConfig() {
|
|
48
|
-
Log.log(_chalk.default.yellow(`No Expo config was found. Please create an Expo config (${_chalk.default.bold`app.json`} or ${_chalk.default.bold`app.config.js`}) in your project root.`));
|
|
60
|
+
Log.log(_chalk().default.yellow(`No Expo config was found. Please create an Expo config (${_chalk().default.bold`app.json`} or ${_chalk().default.bold`app.config.js`}) in your project root.`));
|
|
49
61
|
}
|
|
50
62
|
function warnAboutConfigAndThrow(type, message, edits) {
|
|
51
63
|
Log.log();
|
|
52
64
|
if (type === "warn") {
|
|
53
65
|
// The project is using a dynamic config, give the user a helpful log and bail out.
|
|
54
|
-
Log.log(_chalk.default.yellow(message));
|
|
66
|
+
Log.log(_chalk().default.yellow(message));
|
|
55
67
|
} else {
|
|
56
68
|
logNoConfig();
|
|
57
69
|
}
|
|
@@ -59,7 +71,7 @@ function warnAboutConfigAndThrow(type, message, edits) {
|
|
|
59
71
|
throw new _errors.SilentError();
|
|
60
72
|
}
|
|
61
73
|
function notifyAboutManualConfigEdits(edits) {
|
|
62
|
-
Log.log(_chalk.default.cyan(`Please add the following to your Expo config`));
|
|
74
|
+
Log.log(_chalk().default.cyan(`Please add the following to your Expo config`));
|
|
63
75
|
Log.log();
|
|
64
76
|
Log.log(JSON.stringify(edits, null, 2));
|
|
65
77
|
Log.log();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/modifyConfigAsync.ts"],"sourcesContent":["import { ExpoConfig, 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<void> {\n const modification = await modifyConfigAsync(projectRoot, edits, {\n skipSDKVersionRequirement: true,\n });\n if (modification.type === 'success') {\n Log.log();\n } else {\n warnAboutConfigAndThrow(modification.type, modification.message!, exactEdits);\n }\n}\n\nfunction logNoConfig() {\n Log.log(\n chalk.yellow(\n `No Expo config was found. Please create an Expo config (${chalk.bold`app.json`} or ${chalk.bold`app.config.js`}) in your project root.`\n )\n );\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 } else {\n logNoConfig();\n }\n\n notifyAboutManualConfigEdits(edits);\n throw new SilentError();\n}\n\nfunction notifyAboutManualConfigEdits(edits: Partial<ExpoConfig>) {\n Log.log(chalk.cyan(`Please 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","Log","projectRoot","edits","exactEdits","modification","modifyConfigAsync","skipSDKVersionRequirement","type","log","message","logNoConfig","chalk","yellow","bold","notifyAboutManualConfigEdits","SilentError","cyan","JSON","stringify"],"mappings":"AAAA;;;;QAOsBA,mBAAmB,GAAnBA,mBAAmB;QAuBzBC,uBAAuB,GAAvBA,uBAAuB;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/modifyConfigAsync.ts"],"sourcesContent":["import { ExpoConfig, 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<void> {\n const modification = await modifyConfigAsync(projectRoot, edits, {\n skipSDKVersionRequirement: true,\n });\n if (modification.type === 'success') {\n Log.log();\n } else {\n warnAboutConfigAndThrow(modification.type, modification.message!, exactEdits);\n }\n}\n\nfunction logNoConfig() {\n Log.log(\n chalk.yellow(\n `No Expo config was found. Please create an Expo config (${chalk.bold`app.json`} or ${chalk.bold`app.config.js`}) in your project root.`\n )\n );\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 } else {\n logNoConfig();\n }\n\n notifyAboutManualConfigEdits(edits);\n throw new SilentError();\n}\n\nfunction notifyAboutManualConfigEdits(edits: Partial<ExpoConfig>) {\n Log.log(chalk.cyan(`Please 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","Log","projectRoot","edits","exactEdits","modification","modifyConfigAsync","skipSDKVersionRequirement","type","log","message","logNoConfig","chalk","yellow","bold","notifyAboutManualConfigEdits","SilentError","cyan","JSON","stringify"],"mappings":"AAAA;;;;QAOsBA,mBAAmB,GAAnBA,mBAAmB;QAuBzBC,uBAAuB,GAAvBA,uBAAuB;SA9BO,OAAc;yBAAd,cAAc;IAAd,OAAc;;;;;SAC1C,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;AAEG,IAAA,OAAU,WAAV,UAAU,CAAA;AAC1BC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGR,eAAeF,mBAAmB,CACvCG,WAAmB,EACnBC,KAA0B,EAC1BC,UAA+B,EAChB;IACf,MAAMC,YAAY,GAAG,MAAMC,OAAiB,oBAAA,CAACJ,WAAW,EAAEC,KAAK,EAAE;QAC/DI,yBAAyB,EAAE,IAAI;KAChC,CAAC,AAAC;IACH,IAAIF,YAAY,CAACG,IAAI,KAAK,SAAS,EAAE;QACnCP,GAAG,CAACQ,GAAG,EAAE,CAAC;KACX,MAAM;QACLT,uBAAuB,CAACK,YAAY,CAACG,IAAI,EAAEH,YAAY,CAACK,OAAO,EAAGN,UAAU,CAAC,CAAC;KAC/E;CACF;AAED,SAASO,WAAW,GAAG;IACrBV,GAAG,CAACQ,GAAG,CACLG,MAAK,UAAA,CAACC,MAAM,CACV,CAAC,wDAAwD,EAAED,MAAK,UAAA,CAACE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAEF,MAAK,UAAA,CAACE,IAAI,CAAC,aAAa,CAAC,CAAC,uBAAuB,CAAC,CACzI,CACF,CAAC;CACH;AAEM,SAASd,uBAAuB,CAACQ,IAAY,EAAEE,OAAe,EAAEP,KAA0B,EAAE;IACjGF,GAAG,CAACQ,GAAG,EAAE,CAAC;IACV,IAAID,IAAI,KAAK,MAAM,EAAE;QACnB,mFAAmF;QACnFP,GAAG,CAACQ,GAAG,CAACG,MAAK,UAAA,CAACC,MAAM,CAACH,OAAO,CAAC,CAAC,CAAC;KAChC,MAAM;QACLC,WAAW,EAAE,CAAC;KACf;IAEDI,4BAA4B,CAACZ,KAAK,CAAC,CAAC;IACpC,MAAM,IAAIa,OAAW,YAAA,EAAE,CAAC;CACzB;AAED,SAASD,4BAA4B,CAACZ,KAA0B,EAAE;IAChEF,GAAG,CAACQ,GAAG,CAACG,MAAK,UAAA,CAACK,IAAI,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,CAAC;IACpEhB,GAAG,CAACQ,GAAG,EAAE,CAAC;IACVR,GAAG,CAACQ,GAAG,CAACS,IAAI,CAACC,SAAS,CAAChB,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACxCF,GAAG,CAACQ,GAAG,EAAE,CAAC;CACX"}
|
|
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.attemptAddingPluginsAsync = attemptAddingPluginsAsync;
|
|
6
|
-
|
|
6
|
+
function _config() {
|
|
7
|
+
const data = require("@expo/config");
|
|
8
|
+
_config = function() {
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
7
13
|
var _modifyConfigAsync = require("./modifyConfigAsync");
|
|
8
14
|
var Log = _interopRequireWildcard(require("../log"));
|
|
9
15
|
function _interopRequireWildcard(obj) {
|
|
@@ -34,7 +40,7 @@ async function attemptAddingPluginsAsync(projectRoot, exp, plugins) {
|
|
|
34
40
|
...new Set((exp.plugins || []).concat(plugins))
|
|
35
41
|
]
|
|
36
42
|
};
|
|
37
|
-
const modification = await (
|
|
43
|
+
const modification = await _config().modifyConfigAsync(projectRoot, edits, {
|
|
38
44
|
skipSDKVersionRequirement: true,
|
|
39
45
|
skipPlugins: true
|
|
40
46
|
});
|