From 6383353d9dec51f68f9e267df1911dc7f8122da6 Mon Sep 17 00:00:00 2001 From: Brian Zhao Date: Tue, 14 Apr 2020 23:20:03 -0700 Subject: [PATCH 1/3] Rename DeveloperSettings.SourceBundlePath -> SourceBundleName --- vnext/Microsoft.ReactNative/ReactHost/React.h | 12 ++++++------ .../ReactHost/ReactInstanceWin.cpp | 6 +++--- vnext/Microsoft.ReactNative/ReactNativeHost.cpp | 2 +- vnext/Microsoft.ReactNative/RedBox.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vnext/Microsoft.ReactNative/ReactHost/React.h b/vnext/Microsoft.ReactNative/ReactHost/React.h index 0faf132becc..6a71dabcfd7 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/React.h +++ b/vnext/Microsoft.ReactNative/ReactHost/React.h @@ -118,17 +118,17 @@ struct ReactDevOptions { std::string DebugHost; //! When using web debugging and/or live reload, the source is obtained from the packager. - //! The source url for the bundle is "http://{HOST}:{PORT}/{PATH}{EXTENSION}?platform=..." + //! The source url for the bundle is "http://{HOST}:{PORT}/{NAME}{EXTENSION}?platform=..." //! which defaults to: //! {HOST} = "localhost", //! {PORT} = "8081", - //! {PATH} = "index.{PLATFORM}" where {PLATFORM} = "ios", "android", "win32", etc. + //! {NAME} = "index.{PLATFORM}" where {PLATFORM} = "ios", "android", "win32", etc. //! {EXTENSION} = ".bundle" //! Specify a value for a component, or leave empty to use the default. - std::string SourceBundleHost; // {HOST} - std::string SourceBundlePort; // {PORT} - std::string SourceBundlePath; // {PATH} - std::string SourceBundleExtension; // {EXTENSION} + std::string SourceBundleHost; // Host domain (without port) for the bundler server. Default: "localhost". + std::string SourceBundlePort; // Host port for the bundler server. Default: "8081". + std::string SourceBundleName; // Bundle name without any extension (e.g. "index.win32"). Default: "index.{PLATFORM}" + std::string SourceBundleExtension; // Bundle name extension. Default: ".bundle". //! Module name used for loading the debug bundle. //! e.g. The modules name registered in the jsbundle via AppRegistry.registerComponent('ModuleName', () => diff --git a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp index 6494964c877..ce5f74b7dff 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +++ b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp @@ -161,7 +161,7 @@ void ReactInstanceWin::Initialize() noexcept { auto devSettings = std::make_shared(); devSettings->useJITCompilation = m_options.EnableJITCompilation; devSettings->debugHost = GetDebugHost(); - devSettings->debugBundlePath = m_options.DeveloperSettings.SourceBundlePath; + devSettings->debugBundlePath = m_options.DeveloperSettings.SourceBundleName; devSettings->liveReloadCallback = GetLiveReloadCallback(); devSettings->errorCallback = GetErrorCallback(); devSettings->loggingCallback = GetLoggingCallback(); @@ -273,8 +273,8 @@ void ReactInstanceWin::Initialize() noexcept { if (m_options.DeveloperSettings.IsDevModeEnabled && State() != ReactInstanceState::HasError) { folly::dynamic params = folly::dynamic::array( STRING(RN_PLATFORM), - m_options.DeveloperSettings.SourceBundlePath.empty() ? m_options.Identity - : m_options.DeveloperSettings.SourceBundlePath, + m_options.DeveloperSettings.SourceBundleName.empty() ? m_options.Identity + : m_options.DeveloperSettings.SourceBundleName, GetSourceBundleHost(), GetSourceBundlePort(), m_options.DeveloperSettings.UseFastRefresh); diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp index 84e127c032f..89e3e986ce9 100644 --- a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp +++ b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp @@ -80,7 +80,7 @@ void ReactNativeHost::ReloadInstance() noexcept { Mso::React::ReactOptions reactOptions{}; reactOptions.DeveloperSettings.IsDevModeEnabled = legacySettings.EnableDeveloperMenu; - reactOptions.DeveloperSettings.SourceBundlePath = legacySettings.DebugBundlePath; + reactOptions.DeveloperSettings.SourceBundleName = legacySettings.DebugBundlePath; reactOptions.DeveloperSettings.UseWebDebugger = legacySettings.UseWebDebugger; reactOptions.DeveloperSettings.UseDirectDebugger = legacySettings.UseDirectDebugger; reactOptions.DeveloperSettings.DebuggerBreakOnNextLine = legacySettings.DebuggerBreakOnNextLine; diff --git a/vnext/Microsoft.ReactNative/RedBox.cpp b/vnext/Microsoft.ReactNative/RedBox.cpp index 30e1f259c44..5f95fcbd928 100644 --- a/vnext/Microsoft.ReactNative/RedBox.cpp +++ b/vnext/Microsoft.ReactNative/RedBox.cpp @@ -277,7 +277,7 @@ struct RedBox : public std::enable_shared_from_this { std::string stackFrameUri = "http://"; stackFrameUri.append(devSettings.SourceBundleHost.empty() ? "localhost" : devSettings.SourceBundleHost); stackFrameUri.append(":"); - stackFrameUri.append(devSettings.SourceBundlePath.empty() ? "8081" : devSettings.SourceBundlePort); + stackFrameUri.append(devSettings.SourceBundlePort.empty() ? "8081" : devSettings.SourceBundlePort); stackFrameUri.append("/open-stack-frame"); Uri uri{Microsoft::Common::Unicode::Utf8ToUtf16(stackFrameUri)}; From 0cafe558e1ea12fb5c2c87879288b99538d1937d Mon Sep 17 00:00:00 2001 From: Brian Zhao Date: Wed, 15 Apr 2020 00:20:55 -0700 Subject: [PATCH 2/3] Change files --- change/react-native-windows-2020-04-15-00-20-55-sbp.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/react-native-windows-2020-04-15-00-20-55-sbp.json diff --git a/change/react-native-windows-2020-04-15-00-20-55-sbp.json b/change/react-native-windows-2020-04-15-00-20-55-sbp.json new file mode 100644 index 00000000000..493fefbd3eb --- /dev/null +++ b/change/react-native-windows-2020-04-15-00-20-55-sbp.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Rename DeveloperSettings.SourceBundlePath -> SourceBundleName", + "packageName": "react-native-windows", + "email": "rezha@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-04-15T07:20:55.380Z" +} \ No newline at end of file From 12aca8c01b855a005dbb6d7d3bba6937e6a88d13 Mon Sep 17 00:00:00 2001 From: Brian Zhao Date: Wed, 15 Apr 2020 11:17:56 -0700 Subject: [PATCH 3/3] clang format --- vnext/Microsoft.ReactNative/ReactHost/React.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnext/Microsoft.ReactNative/ReactHost/React.h b/vnext/Microsoft.ReactNative/ReactHost/React.h index 6a71dabcfd7..567fa021cf4 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/React.h +++ b/vnext/Microsoft.ReactNative/ReactHost/React.h @@ -125,9 +125,9 @@ struct ReactDevOptions { //! {NAME} = "index.{PLATFORM}" where {PLATFORM} = "ios", "android", "win32", etc. //! {EXTENSION} = ".bundle" //! Specify a value for a component, or leave empty to use the default. - std::string SourceBundleHost; // Host domain (without port) for the bundler server. Default: "localhost". - std::string SourceBundlePort; // Host port for the bundler server. Default: "8081". - std::string SourceBundleName; // Bundle name without any extension (e.g. "index.win32"). Default: "index.{PLATFORM}" + std::string SourceBundleHost; // Host domain (without port) for the bundler server. Default: "localhost". + std::string SourceBundlePort; // Host port for the bundler server. Default: "8081". + std::string SourceBundleName; // Bundle name without any extension (e.g. "index.win32"). Default: "index.{PLATFORM}" std::string SourceBundleExtension; // Bundle name extension. Default: ".bundle". //! Module name used for loading the debug bundle.