react-native-windows 0.71.26 → 0.71.28

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.
Files changed (47) hide show
  1. package/Directory.Build.props +0 -5
  2. package/Microsoft.ReactNative/IReactDispatcher.cpp +0 -4
  3. package/Microsoft.ReactNative/IReactDispatcher.h +0 -1
  4. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +4 -2
  5. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +11 -31
  6. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +2 -0
  7. package/Microsoft.ReactNative/Views/DevMenu.cpp +3 -3
  8. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +2103 -0
  9. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +73 -0
  10. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +12 -43
  11. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +6 -17
  12. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  13. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  14. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  15. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  16. package/PropertySheets/JSEngine.props +4 -4
  17. package/PropertySheets/React.Cpp.props +0 -1
  18. package/PropertySheets/Warnings.props +0 -6
  19. package/ReactCommon/ReactCommon.vcxproj +1 -53
  20. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +0 -36
  21. package/Shared/DevSupportManager.cpp +9 -2
  22. package/Shared/DevSupportManager.h +6 -2
  23. package/Shared/HermesRuntimeHolder.cpp +84 -344
  24. package/Shared/HermesRuntimeHolder.h +21 -32
  25. package/Shared/HermesSamplingProfiler.cpp +14 -66
  26. package/Shared/HermesSamplingProfiler.h +3 -5
  27. package/Shared/HermesShim.cpp +118 -0
  28. package/Shared/HermesShim.h +21 -0
  29. package/Shared/InspectorPackagerConnection.cpp +108 -62
  30. package/Shared/InspectorPackagerConnection.h +21 -9
  31. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +209 -0
  32. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +44 -0
  33. package/Shared/JSI/RuntimeHolder.h +2 -2
  34. package/Shared/JSI/ScriptStore.h +20 -18
  35. package/Shared/OInstance.cpp +45 -26
  36. package/Shared/Shared.vcxitems +8 -19
  37. package/Shared/Shared.vcxitems.filters +30 -23
  38. package/Shared/V8JSIRuntimeHolder.cpp +70 -0
  39. package/Shared/V8JSIRuntimeHolder.h +53 -0
  40. package/package.json +2 -2
  41. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  42. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +0 -16
  43. package/ReactCommon/cgmanifest.json +0 -15
  44. package/Shared/JSI/V8RuntimeHolder.cpp +0 -260
  45. package/Shared/JSI/V8RuntimeHolder.h +0 -37
  46. package/Shared/SafeLoadLibrary.cpp +0 -41
  47. package/Shared/SafeLoadLibrary.h +0 -15
@@ -21,8 +21,6 @@
21
21
  <!-- When bumping the fmt version, be sure to bump the git hash of that version's commit and build fmt.vcxproj (to update its cgmanifest.json) too. -->
22
22
  <FmtVersion>8.0.0</FmtVersion>
23
23
  <FmtCommitHash>9e8b86fd2d9806672cc73133d21780dd182bfd24</FmtCommitHash>
24
- <!-- Commit hash for https://github.com/microsoft/node-api-jsi code. -->
25
- <NodeApiJsiCommitHash>53b897b03c1c7e57c3372acc6234447a44e150d6</NodeApiJsiCommitHash>
26
24
  </PropertyGroup>
27
25
 
28
26
  <!--
@@ -42,9 +40,6 @@
42
40
 
43
41
  <FmtDir Condition="'$(FmtDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.fmt\fmt-$(FmtVersion)</FmtDir>
44
42
  <FmtDir>$([MSBuild]::NormalizeDirectory($(FmtDir)))</FmtDir>
45
-
46
- <NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.node-api-jsi\node-api-jsi-$(NodeApiJsiCommitHash)</NodeApiJsiDir>
47
- <NodeApiJsiDir>$([MSBuild]::NormalizeDirectory($(NodeApiJsiDir)))</NodeApiJsiDir>
48
43
  </PropertyGroup>
49
44
 
50
45
  <PropertyGroup Label="Configuration">
@@ -124,10 +124,6 @@ void ReactDispatcher::InvokeElsePost(Mso::DispatchTask &&task) const noexcept {
124
124
  return jsThreadDispatcherProperty;
125
125
  }
126
126
 
127
- /*static*/ IReactDispatcher ReactDispatcher::GetJSDispatcher(IReactPropertyBag const &properties) noexcept {
128
- return properties.Get(JSDispatcherProperty()).try_as<IReactDispatcher>();
129
- }
130
-
131
127
  /*static*/ IReactPropertyName ReactDispatcher::JSDispatcherTaskStartingEventName() noexcept {
132
128
  static IReactPropertyName jsThreadDispatcherProperty{ReactPropertyBagHelper::GetName(
133
129
  ReactPropertyBagHelper::GetNamespace(L"ReactNative.Dispatcher"), L"JSDispatcherTaskStartingEventName")};
@@ -38,7 +38,6 @@ struct ReactDispatcher : implements<ReactDispatcher, IReactDispatcher, Mso::Reac
38
38
  static void SetUIThreadDispatcher(IReactPropertyBag const &properties) noexcept;
39
39
 
40
40
  static IReactPropertyName JSDispatcherProperty() noexcept;
41
- static IReactDispatcher GetJSDispatcher(IReactPropertyBag const &properties) noexcept;
42
41
  static IReactPropertyName JSDispatcherTaskStartingEventName() noexcept;
43
42
  static IReactPropertyName JSDispatcherIdleWaitStartingEventName() noexcept;
44
43
  static IReactPropertyName JSDispatcherIdleWaitCompletedEventName() noexcept;
@@ -18,7 +18,6 @@
18
18
  <CppWinRTNamespaceMergeDepth>
19
19
  </CppWinRTNamespaceMergeDepth>
20
20
  <CppWinRTLibs>true</CppWinRTLibs>
21
- <BuildMSRNCxxModule>false</BuildMSRNCxxModule>
22
21
  <BuildMSRNCxxReactCommon>false</BuildMSRNCxxReactCommon>
23
22
  <DesktopCompatible Condition="'$(UseWinUI3)'=='true'">true</DesktopCompatible>
24
23
  </PropertyGroup>
@@ -220,6 +219,9 @@
220
219
  <DependentUpon>IReactNotificationService.idl</DependentUpon>
221
220
  <SubType>Code</SubType>
222
221
  </ClInclude>
222
+ <ClInclude Include="JsiApi.h">
223
+ <DependentUpon>JsiApi.idl</DependentUpon>
224
+ </ClInclude>
223
225
  <ClInclude Include="JsiReader.h">
224
226
  <DependentUpon>IJSValueReader.idl</DependentUpon>
225
227
  </ClInclude>
@@ -743,7 +745,7 @@
743
745
  <ItemGroup>
744
746
  <PackageReference Include="boost" Version="1.76.0.0" />
745
747
  <PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
746
- <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" />
748
+ <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" />
747
749
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
748
750
  <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
749
751
  </ItemGroup>
@@ -63,12 +63,12 @@
63
63
  #include <Utils/UwpScriptStore.h>
64
64
  #endif
65
65
 
66
- #include "BaseScriptStoreImpl.h"
67
66
  #include "HermesRuntimeHolder.h"
68
67
 
69
68
  #if defined(USE_V8)
70
69
  #include <winrt/Windows.Storage.h>
71
- #include "JSI/V8RuntimeHolder.h"
70
+ #include "BaseScriptStoreImpl.h"
71
+ #include "V8JSIRuntimeHolder.h"
72
72
  #endif // USE_V8
73
73
 
74
74
  #include "RedBox.h"
@@ -246,7 +246,6 @@ ReactInstanceWin::ReactInstanceWin(
246
246
  onDestroyed = m_options.OnInstanceDestroyed,
247
247
  reactContext = m_reactContext]() noexcept {
248
248
  whenLoaded.TryCancel(); // It only has an effect if whenLoaded was not set before
249
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(ReactPropertyBag(reactContext->Properties()), nullptr);
250
249
  if (onDestroyed) {
251
250
  onDestroyed.Get()->Invoke(reactContext);
252
251
  }
@@ -468,26 +467,10 @@ void ReactInstanceWin::Initialize() noexcept {
468
467
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
469
468
 
470
469
  switch (m_options.JsiEngine()) {
471
- case JSIEngine::Hermes: {
472
- // TODO: Should we use UwpPreparedScriptStore?
473
- if (Microsoft::ReactNative::HasPackageIdentity()) {
474
- preparedScriptStore =
475
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
476
- } else {
477
- wchar_t tempPath[MAX_PATH];
478
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
479
- preparedScriptStore =
480
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
481
- }
482
- }
483
-
484
- auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
485
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
486
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(
487
- ReactPropertyBag(m_reactContext->Properties()), hermesRuntimeHolder);
488
- devSettings->jsiRuntimeHolder = hermesRuntimeHolder;
470
+ case JSIEngine::Hermes:
471
+ devSettings->jsiRuntimeHolder =
472
+ std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
489
473
  break;
490
- }
491
474
  case JSIEngine::V8:
492
475
  #if defined(USE_V8)
493
476
  {
@@ -501,16 +484,10 @@ void ReactInstanceWin::Initialize() noexcept {
501
484
  std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
502
485
  }
503
486
  }
504
-
505
- bool enableMultiThreadSupport{false};
506
- #ifdef USE_FABRIC
507
- enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
508
- #endif // USE_FABRIC
509
-
510
- devSettings->jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::V8RuntimeHolder>(
511
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore), enableMultiThreadSupport);
512
- break;
513
487
  }
488
+ devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
489
+ devSettings, m_jsMessageThread.Load(), std::move(scriptStore), std::move(preparedScriptStore));
490
+ break;
514
491
  #endif // USE_V8
515
492
  case JSIEngine::Chakra:
516
493
  #ifndef CORE_ABI
@@ -1093,10 +1070,13 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1093
1070
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1094
1071
  }
1095
1072
 
1073
+ #if defined(USE_V8)
1096
1074
  std::string ReactInstanceWin::getApplicationTempFolder() {
1097
1075
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1076
+
1098
1077
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1099
1078
  }
1079
+ #endif
1100
1080
 
1101
1081
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1102
1082
  return m_useWebDebugger;
@@ -136,7 +136,9 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
136
136
  folly::dynamic Args;
137
137
  };
138
138
 
139
+ #if defined(USE_V8)
139
140
  static std::string getApplicationTempFolder();
141
+ #endif
140
142
 
141
143
  private: // immutable fields
142
144
  const Mso::WeakPtr<IReactHost> m_weakReactHost;
@@ -119,7 +119,7 @@ void DevMenuManager::CreateAndShowUI() noexcept {
119
119
 
120
120
  std::ostringstream os;
121
121
  if (Microsoft::ReactNative::HermesSamplingProfiler::IsStarted()) {
122
- os << "Hermes Sampling profiler is running!";
122
+ os << "Hermes Sampling profiler is running.. !";
123
123
  } else {
124
124
  os << "Click to start.";
125
125
  }
@@ -210,9 +210,9 @@ void DevMenuManager::CreateAndShowUI() noexcept {
210
210
  if (auto strongThis = wkThis.lock()) {
211
211
  strongThis->Hide();
212
212
  if (!Microsoft::ReactNative::HermesSamplingProfiler::IsStarted()) {
213
- Microsoft::ReactNative::HermesSamplingProfiler::Start(strongThis->m_context);
213
+ Microsoft::ReactNative::HermesSamplingProfiler::Start();
214
214
  } else {
215
- auto traceFilePath = co_await Microsoft::ReactNative::HermesSamplingProfiler::Stop(strongThis->m_context);
215
+ auto traceFilePath = co_await Microsoft::ReactNative::HermesSamplingProfiler::Stop();
216
216
  auto uiDispatcher =
217
217
  React::implementation::ReactDispatcher::GetUIDispatcher(strongThis->m_context->Properties());
218
218
  uiDispatcher.Post([traceFilePath]() {