react-native-windows 0.71.18 → 0.71.19

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 (49) 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/Views/FrameworkElementViewManager.cpp +1 -1
  9. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +2103 -0
  10. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +73 -0
  11. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +12 -43
  12. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +6 -17
  13. package/Microsoft.ReactNative.Managed/packages.lock.json +8 -8
  14. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  15. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  16. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  17. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  18. package/PropertySheets/JSEngine.props +4 -4
  19. package/PropertySheets/React.Cpp.props +0 -1
  20. package/PropertySheets/Warnings.props +0 -6
  21. package/ReactCommon/ReactCommon.vcxproj +1 -53
  22. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +0 -36
  23. package/Shared/DevSupportManager.cpp +9 -2
  24. package/Shared/DevSupportManager.h +6 -2
  25. package/Shared/HermesRuntimeHolder.cpp +84 -344
  26. package/Shared/HermesRuntimeHolder.h +21 -32
  27. package/Shared/HermesSamplingProfiler.cpp +14 -66
  28. package/Shared/HermesSamplingProfiler.h +3 -5
  29. package/Shared/HermesShim.cpp +118 -0
  30. package/Shared/HermesShim.h +21 -0
  31. package/Shared/InspectorPackagerConnection.cpp +108 -62
  32. package/Shared/InspectorPackagerConnection.h +21 -9
  33. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +209 -0
  34. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +44 -0
  35. package/Shared/JSI/RuntimeHolder.h +2 -2
  36. package/Shared/JSI/ScriptStore.h +20 -18
  37. package/Shared/OInstance.cpp +33 -17
  38. package/Shared/Shared.vcxitems +8 -19
  39. package/Shared/Shared.vcxitems.filters +30 -23
  40. package/Shared/V8JSIRuntimeHolder.cpp +70 -0
  41. package/Shared/V8JSIRuntimeHolder.h +53 -0
  42. package/package.json +2 -2
  43. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  44. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +0 -16
  45. package/ReactCommon/cgmanifest.json +0 -15
  46. package/Shared/JSI/V8RuntimeHolder.cpp +0 -262
  47. package/Shared/JSI/V8RuntimeHolder.h +0 -37
  48. package/Shared/SafeLoadLibrary.cpp +0 -41
  49. 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>
@@ -221,6 +220,9 @@
221
220
  <DependentUpon>IReactNotificationService.idl</DependentUpon>
222
221
  <SubType>Code</SubType>
223
222
  </ClInclude>
223
+ <ClInclude Include="JsiApi.h">
224
+ <DependentUpon>JsiApi.idl</DependentUpon>
225
+ </ClInclude>
224
226
  <ClInclude Include="JsiReader.h">
225
227
  <DependentUpon>IJSValueReader.idl</DependentUpon>
226
228
  </ClInclude>
@@ -745,7 +747,7 @@
745
747
  <ItemGroup>
746
748
  <PackageReference Include="boost" Version="1.76.0.0" />
747
749
  <PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
748
- <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" />
750
+ <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" />
749
751
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
750
752
  <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
751
753
  </ItemGroup>
@@ -65,12 +65,12 @@
65
65
  #include <Utils/UwpScriptStore.h>
66
66
  #endif
67
67
 
68
- #include "BaseScriptStoreImpl.h"
69
68
  #include "HermesRuntimeHolder.h"
70
69
 
71
70
  #if defined(USE_V8)
72
71
  #include <winrt/Windows.Storage.h>
73
- #include "JSI/V8RuntimeHolder.h"
72
+ #include "BaseScriptStoreImpl.h"
73
+ #include "V8JSIRuntimeHolder.h"
74
74
  #endif // USE_V8
75
75
 
76
76
  #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
  }
@@ -466,26 +465,10 @@ void ReactInstanceWin::Initialize() noexcept {
466
465
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
467
466
 
468
467
  switch (m_options.JsiEngine()) {
469
- case JSIEngine::Hermes: {
470
- // TODO: Should we use UwpPreparedScriptStore?
471
- if (Microsoft::ReactNative::HasPackageIdentity()) {
472
- preparedScriptStore =
473
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
474
- } else {
475
- wchar_t tempPath[MAX_PATH];
476
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
477
- preparedScriptStore =
478
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
479
- }
480
- }
481
-
482
- auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
483
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
484
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(
485
- ReactPropertyBag(m_reactContext->Properties()), hermesRuntimeHolder);
486
- devSettings->jsiRuntimeHolder = hermesRuntimeHolder;
468
+ case JSIEngine::Hermes:
469
+ devSettings->jsiRuntimeHolder =
470
+ std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
487
471
  break;
488
- }
489
472
  case JSIEngine::V8:
490
473
  #if defined(USE_V8)
491
474
  {
@@ -499,16 +482,10 @@ void ReactInstanceWin::Initialize() noexcept {
499
482
  std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
500
483
  }
501
484
  }
502
-
503
- bool enableMultiThreadSupport{false};
504
- #ifdef USE_FABRIC
505
- enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
506
- #endif // USE_FABRIC
507
-
508
- devSettings->jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::V8RuntimeHolder>(
509
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore), enableMultiThreadSupport);
510
- break;
511
485
  }
486
+ devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
487
+ devSettings, m_jsMessageThread.Load(), std::move(scriptStore), std::move(preparedScriptStore));
488
+ break;
512
489
  #endif // USE_V8
513
490
  case JSIEngine::Chakra:
514
491
  #ifndef CORE_ABI
@@ -1091,10 +1068,13 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1091
1068
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1092
1069
  }
1093
1070
 
1071
+ #if defined(USE_V8)
1094
1072
  std::string ReactInstanceWin::getApplicationTempFolder() {
1095
1073
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1074
+
1096
1075
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1097
1076
  }
1077
+ #endif
1098
1078
 
1099
1079
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1100
1080
  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]() {
@@ -493,7 +493,7 @@ bool FrameworkElementViewManager::UpdateProperty(
493
493
  states[static_cast<int32_t>(winrt::Microsoft::ReactNative::AccessibilityStates::Expanded)] =
494
494
  !innerValue.IsNull() && innerValue.AsBoolean();
495
495
  states[static_cast<int32_t>(winrt::Microsoft::ReactNative::AccessibilityStates::Collapsed)] =
496
- innerValue.IsNull() || !innerValue.AsBoolean();
496
+ innerValue.IsNull() ? false : !innerValue.AsBoolean();
497
497
 
498
498
  const auto prevExpandedState = DynamicAutomationProperties::GetAccessibilityStateExpanded(element);
499
499