react-native-windows 0.71.36 → 0.71.37

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 -30
  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 +32 -16
  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 -77
  47. package/Shared/SafeLoadLibrary.h +0 -19
@@ -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"
@@ -247,7 +247,6 @@ ReactInstanceWin::ReactInstanceWin(
247
247
  onDestroyed = m_options.OnInstanceDestroyed,
248
248
  reactContext = m_reactContext]() noexcept {
249
249
  whenLoaded.TryCancel(); // It only has an effect if whenLoaded was not set before
250
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(ReactPropertyBag(reactContext->Properties()), nullptr);
251
250
  if (onDestroyed) {
252
251
  onDestroyed.Get()->Invoke(reactContext);
253
252
  }
@@ -471,25 +470,10 @@ void ReactInstanceWin::Initialize() noexcept {
471
470
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
472
471
 
473
472
  switch (m_options.JsiEngine()) {
474
- case JSIEngine::Hermes: {
475
- if (Microsoft::ReactNative::HasPackageIdentity()) {
476
- preparedScriptStore =
477
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
478
- } else {
479
- wchar_t tempPath[MAX_PATH];
480
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
481
- preparedScriptStore =
482
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
483
- }
484
- }
485
-
486
- auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
487
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
488
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(
489
- ReactPropertyBag(m_reactContext->Properties()), hermesRuntimeHolder);
490
- devSettings->jsiRuntimeHolder = hermesRuntimeHolder;
473
+ case JSIEngine::Hermes:
474
+ devSettings->jsiRuntimeHolder =
475
+ std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
491
476
  break;
492
- }
493
477
  case JSIEngine::V8:
494
478
  #if defined(USE_V8)
495
479
  {
@@ -503,16 +487,10 @@ void ReactInstanceWin::Initialize() noexcept {
503
487
  std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
504
488
  }
505
489
  }
506
-
507
- bool enableMultiThreadSupport{false};
508
- #ifdef USE_FABRIC
509
- enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
510
- #endif // USE_FABRIC
511
-
512
- devSettings->jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::V8RuntimeHolder>(
513
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore), enableMultiThreadSupport);
514
- break;
515
490
  }
491
+ devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
492
+ devSettings, m_jsMessageThread.Load(), std::move(scriptStore), std::move(preparedScriptStore));
493
+ break;
516
494
  #endif // USE_V8
517
495
  case JSIEngine::Chakra:
518
496
  #ifndef CORE_ABI
@@ -1098,10 +1076,13 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1098
1076
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1099
1077
  }
1100
1078
 
1079
+ #if defined(USE_V8)
1101
1080
  std::string ReactInstanceWin::getApplicationTempFolder() {
1102
1081
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1082
+
1103
1083
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1104
1084
  }
1085
+ #endif
1105
1086
 
1106
1087
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1107
1088
  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]() {