react-native-windows 0.71.35 → 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 (48) 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 +23 -36
  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/DevSettings.h +3 -0
  22. package/Shared/DevSupportManager.cpp +9 -2
  23. package/Shared/DevSupportManager.h +6 -2
  24. package/Shared/HermesRuntimeHolder.cpp +84 -344
  25. package/Shared/HermesRuntimeHolder.h +21 -32
  26. package/Shared/HermesSamplingProfiler.cpp +14 -66
  27. package/Shared/HermesSamplingProfiler.h +3 -5
  28. package/Shared/HermesShim.cpp +118 -0
  29. package/Shared/HermesShim.h +21 -0
  30. package/Shared/InspectorPackagerConnection.cpp +108 -62
  31. package/Shared/InspectorPackagerConnection.h +21 -9
  32. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +209 -0
  33. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +44 -0
  34. package/Shared/JSI/RuntimeHolder.h +2 -2
  35. package/Shared/JSI/ScriptStore.h +20 -18
  36. package/Shared/OInstance.cpp +56 -41
  37. package/Shared/Shared.vcxitems +8 -19
  38. package/Shared/Shared.vcxitems.filters +30 -23
  39. package/Shared/V8JSIRuntimeHolder.cpp +70 -0
  40. package/Shared/V8JSIRuntimeHolder.h +53 -0
  41. package/package.json +2 -2
  42. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  43. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +0 -16
  44. package/ReactCommon/cgmanifest.json +0 -15
  45. package/Shared/JSI/V8RuntimeHolder.cpp +0 -260
  46. package/Shared/JSI/V8RuntimeHolder.h +0 -37
  47. package/Shared/SafeLoadLibrary.cpp +0 -77
  48. 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"
@@ -76,6 +76,7 @@
76
76
  #include <tuple>
77
77
  #include "ChakraRuntimeHolder.h"
78
78
 
79
+ #include <CppRuntimeOptions.h>
79
80
  #include <CreateModules.h>
80
81
  #include <Utils/Helpers.h>
81
82
  #include "CrashManager.h"
@@ -246,7 +247,6 @@ ReactInstanceWin::ReactInstanceWin(
246
247
  onDestroyed = m_options.OnInstanceDestroyed,
247
248
  reactContext = m_reactContext]() noexcept {
248
249
  whenLoaded.TryCancel(); // It only has an effect if whenLoaded was not set before
249
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(ReactPropertyBag(reactContext->Properties()), nullptr);
250
250
  if (onDestroyed) {
251
251
  onDestroyed.Get()->Invoke(reactContext);
252
252
  }
@@ -373,15 +373,17 @@ void ReactInstanceWin::LoadModules(
373
373
  L"Timing", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::Timing>());
374
374
  #endif
375
375
 
376
- registerTurboModule(::Microsoft::React::GetBlobTurboModuleName(), ::Microsoft::React::GetBlobModuleProvider());
376
+ registerTurboModule(
377
+ ::Microsoft::React::GetWebSocketTurboModuleName(), ::Microsoft::React::GetWebSocketModuleProvider());
377
378
 
378
- registerTurboModule(::Microsoft::React::GetHttpTurboModuleName(), ::Microsoft::React::GetHttpModuleProvider());
379
+ if (!Microsoft::React::GetRuntimeOptionBool("Blob.DisableModule")) {
380
+ registerTurboModule(::Microsoft::React::GetHttpTurboModuleName(), ::Microsoft::React::GetHttpModuleProvider());
379
381
 
380
- registerTurboModule(
381
- ::Microsoft::React::GetFileReaderTurboModuleName(), ::Microsoft::React::GetFileReaderModuleProvider());
382
+ registerTurboModule(::Microsoft::React::GetBlobTurboModuleName(), ::Microsoft::React::GetBlobModuleProvider());
382
383
 
383
- registerTurboModule(
384
- ::Microsoft::React::GetWebSocketTurboModuleName(), ::Microsoft::React::GetWebSocketModuleProvider());
384
+ registerTurboModule(
385
+ ::Microsoft::React::GetFileReaderTurboModuleName(), ::Microsoft::React::GetFileReaderModuleProvider());
386
+ }
385
387
  }
386
388
 
387
389
  //! Initialize() is called from the native queue.
@@ -468,25 +470,10 @@ void ReactInstanceWin::Initialize() noexcept {
468
470
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
469
471
 
470
472
  switch (m_options.JsiEngine()) {
471
- case JSIEngine::Hermes: {
472
- if (Microsoft::ReactNative::HasPackageIdentity()) {
473
- preparedScriptStore =
474
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
475
- } else {
476
- wchar_t tempPath[MAX_PATH];
477
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
478
- preparedScriptStore =
479
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
480
- }
481
- }
482
-
483
- auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
484
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
485
- Microsoft::ReactNative::HermesRuntimeHolder::storeTo(
486
- ReactPropertyBag(m_reactContext->Properties()), hermesRuntimeHolder);
487
- devSettings->jsiRuntimeHolder = hermesRuntimeHolder;
473
+ case JSIEngine::Hermes:
474
+ devSettings->jsiRuntimeHolder =
475
+ std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
488
476
  break;
489
- }
490
477
  case JSIEngine::V8:
491
478
  #if defined(USE_V8)
492
479
  {
@@ -500,16 +487,10 @@ void ReactInstanceWin::Initialize() noexcept {
500
487
  std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
501
488
  }
502
489
  }
503
-
504
- bool enableMultiThreadSupport{false};
505
- #ifdef USE_FABRIC
506
- enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
507
- #endif // USE_FABRIC
508
-
509
- devSettings->jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::V8RuntimeHolder>(
510
- devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore), enableMultiThreadSupport);
511
- break;
512
490
  }
491
+ devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
492
+ devSettings, m_jsMessageThread.Load(), std::move(scriptStore), std::move(preparedScriptStore));
493
+ break;
513
494
  #endif // USE_V8
514
495
  case JSIEngine::Chakra:
515
496
  #ifndef CORE_ABI
@@ -530,6 +511,9 @@ void ReactInstanceWin::Initialize() noexcept {
530
511
  // We need to keep the instance wrapper alive as its destruction shuts down the native queue.
531
512
  m_options.TurboModuleProvider->SetReactContext(
532
513
  winrt::make<implementation::ReactContext>(Mso::Copy(m_reactContext)));
514
+ auto omitNetCxxPropName = ReactPropertyBagHelper::GetName(nullptr, L"OmitNetworkingCxxModules");
515
+ auto omitNetCxxPropValue = m_options.Properties.Get(omitNetCxxPropName);
516
+ devSettings->omitNetworkingCxxModules = winrt::unbox_value_or(omitNetCxxPropValue, false);
533
517
  auto bundleRootPath = devSettings->bundleRootPath;
534
518
  auto instanceWrapper = facebook::react::CreateReactInstance(
535
519
  std::shared_ptr<facebook::react::Instance>(strongThis->m_instance.Load()),
@@ -1092,10 +1076,13 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1092
1076
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1093
1077
  }
1094
1078
 
1079
+ #if defined(USE_V8)
1095
1080
  std::string ReactInstanceWin::getApplicationTempFolder() {
1096
1081
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1082
+
1097
1083
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1098
1084
  }
1085
+ #endif
1099
1086
 
1100
1087
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1101
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]() {