react-native-windows 0.71.24 → 0.71.25

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 (77) hide show
  1. package/Directory.Build.props +5 -0
  2. package/Libraries/Network/RCTNetworking.windows.js +10 -16
  3. package/Microsoft.ReactNative/IReactDispatcher.cpp +4 -0
  4. package/Microsoft.ReactNative/IReactDispatcher.h +1 -0
  5. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +3 -7
  6. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -7
  7. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +43 -21
  8. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -2
  9. package/Microsoft.ReactNative/Views/DevMenu.cpp +3 -3
  10. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +16 -0
  11. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +43 -12
  12. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +17 -6
  13. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  14. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  15. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  16. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  17. package/PropertySheets/JSEngine.props +4 -4
  18. package/PropertySheets/React.Cpp.props +3 -3
  19. package/PropertySheets/Warnings.props +6 -0
  20. package/ReactCommon/ReactCommon.vcxproj +53 -1
  21. package/ReactCommon/cgmanifest.json +15 -0
  22. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +36 -0
  23. package/Shared/BaseFileReaderResource.cpp +95 -0
  24. package/Shared/BaseFileReaderResource.h +41 -0
  25. package/Shared/CreateModules.h +27 -5
  26. package/Shared/DevSupportManager.cpp +2 -9
  27. package/Shared/DevSupportManager.h +2 -6
  28. package/Shared/HermesRuntimeHolder.cpp +344 -84
  29. package/Shared/HermesRuntimeHolder.h +32 -21
  30. package/Shared/HermesSamplingProfiler.cpp +66 -14
  31. package/Shared/HermesSamplingProfiler.h +5 -3
  32. package/Shared/IFileReaderResource.h +36 -0
  33. package/Shared/InspectorPackagerConnection.cpp +62 -108
  34. package/Shared/InspectorPackagerConnection.h +9 -21
  35. package/Shared/JSI/RuntimeHolder.h +2 -2
  36. package/Shared/JSI/ScriptStore.h +18 -20
  37. package/Shared/JSI/V8RuntimeHolder.cpp +260 -0
  38. package/Shared/JSI/V8RuntimeHolder.h +37 -0
  39. package/Shared/Modules/BlobModule.cpp +93 -298
  40. package/Shared/Modules/BlobModule.h +25 -91
  41. package/Shared/Modules/CxxModuleUtilities.cpp +32 -0
  42. package/Shared/Modules/CxxModuleUtilities.h +17 -0
  43. package/Shared/Modules/FileReaderModule.cpp +118 -51
  44. package/Shared/Modules/FileReaderModule.h +27 -1
  45. package/Shared/Modules/HttpModule.cpp +133 -9
  46. package/Shared/Modules/HttpModule.h +33 -0
  47. package/Shared/Modules/IRequestBodyHandler.h +6 -4
  48. package/Shared/Modules/IResponseHandler.h +3 -3
  49. package/Shared/Modules/IUriHandler.h +3 -3
  50. package/Shared/Modules/IWebSocketModuleContentHandler.h +6 -4
  51. package/Shared/Modules/WebSocketModule.cpp +190 -7
  52. package/Shared/Modules/WebSocketTurboModule.h +52 -0
  53. package/Shared/Networking/DefaultBlobResource.cpp +323 -0
  54. package/Shared/Networking/DefaultBlobResource.h +133 -0
  55. package/Shared/Networking/IBlobResource.h +56 -0
  56. package/Shared/Networking/IHttpResource.h +6 -5
  57. package/Shared/Networking/WinRTHttpResource.cpp +40 -32
  58. package/Shared/Networking/WinRTHttpResource.h +4 -3
  59. package/Shared/Networking/WinRTTypes.h +3 -3
  60. package/Shared/OInstance.cpp +17 -33
  61. package/Shared/SafeLoadLibrary.cpp +41 -0
  62. package/Shared/SafeLoadLibrary.h +15 -0
  63. package/Shared/Shared.vcxitems +27 -9
  64. package/Shared/Shared.vcxitems.filters +47 -33
  65. package/package.json +2 -2
  66. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  67. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -59
  68. package/Microsoft.ReactNative/Base/CoreNativeModules.h +0 -30
  69. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +0 -2103
  70. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +0 -73
  71. package/Shared/HermesShim.cpp +0 -118
  72. package/Shared/HermesShim.h +0 -21
  73. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +0 -209
  74. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +0 -44
  75. package/Shared/V8JSIRuntimeHolder.cpp +0 -70
  76. package/Shared/V8JSIRuntimeHolder.h +0 -53
  77. /package/Shared/{Modules/IBlobPersistor.h → IBlobPersistor.h} +0 -0
@@ -21,6 +21,8 @@
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>
24
26
  </PropertyGroup>
25
27
 
26
28
  <!--
@@ -40,6 +42,9 @@
40
42
 
41
43
  <FmtDir Condition="'$(FmtDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.fmt\fmt-$(FmtVersion)</FmtDir>
42
44
  <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>
43
48
  </PropertyGroup>
44
49
 
45
50
  <PropertyGroup Label="Configuration">
@@ -1,6 +1,8 @@
1
1
  /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
4
6
  *
5
7
  * @flow strict-local
6
8
  * @format
@@ -9,11 +11,10 @@
9
11
  'use strict';
10
12
 
11
13
  import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
12
- const RCTNetworkingNative =
13
- require('../BatchedBridge/NativeModules').Networking; // [Windows]
14
- import {type NativeResponseType} from './XMLHttpRequest';
15
- import convertRequestBody, {type RequestBody} from './convertRequestBody';
16
14
  import {type EventSubscription} from '../vendor/emitter/EventEmitter';
15
+ import convertRequestBody, {type RequestBody} from './convertRequestBody';
16
+ import NativeNetworkingIOS from './NativeNetworkingIOS';
17
+ import {type NativeResponseType} from './XMLHttpRequest';
17
18
 
18
19
  type RCTNetworkingEventDefinitions = $ReadOnly<{
19
20
  didSendNetworkData: [
@@ -61,11 +62,6 @@ type RCTNetworkingEventDefinitions = $ReadOnly<{
61
62
  ],
62
63
  }>;
63
64
 
64
- let _requestId = 1;
65
- function generateRequestId(): number {
66
- return _requestId++;
67
- }
68
-
69
65
  const RCTNetworking = {
70
66
  addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
71
67
  eventType: K,
@@ -88,13 +84,11 @@ const RCTNetworking = {
88
84
  callback: (requestId: number) => void,
89
85
  withCredentials: boolean,
90
86
  ) {
91
- const requestId = generateRequestId();
92
87
  const body = convertRequestBody(data);
93
- RCTNetworkingNative.sendRequest(
88
+ NativeNetworkingIOS.sendRequest(
94
89
  {
95
90
  method,
96
91
  url,
97
- requestId,
98
92
  data: {...body, trackingName},
99
93
  headers,
100
94
  responseType,
@@ -107,11 +101,11 @@ const RCTNetworking = {
107
101
  },
108
102
 
109
103
  abortRequest(requestId: number) {
110
- RCTNetworkingNative.abortRequest(requestId);
104
+ NativeNetworkingIOS.abortRequest(requestId);
111
105
  },
112
106
 
113
107
  clearCookies(callback: (result: boolean) => void) {
114
- RCTNetworkingNative.clearCookies(callback);
108
+ NativeNetworkingIOS.clearCookies(callback);
115
109
  },
116
110
  };
117
111
 
@@ -124,6 +124,10 @@ 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
+
127
131
  /*static*/ IReactPropertyName ReactDispatcher::JSDispatcherTaskStartingEventName() noexcept {
128
132
  static IReactPropertyName jsThreadDispatcherProperty{ReactPropertyBagHelper::GetName(
129
133
  ReactPropertyBagHelper::GetNamespace(L"ReactNative.Dispatcher"), L"JSDispatcherTaskStartingEventName")};
@@ -38,6 +38,7 @@ 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;
41
42
  static IReactPropertyName JSDispatcherTaskStartingEventName() noexcept;
42
43
  static IReactPropertyName JSDispatcherIdleWaitStartingEventName() noexcept;
43
44
  static IReactPropertyName JSDispatcherIdleWaitCompletedEventName() noexcept;
@@ -18,6 +18,7 @@
18
18
  <CppWinRTNamespaceMergeDepth>
19
19
  </CppWinRTNamespaceMergeDepth>
20
20
  <CppWinRTLibs>true</CppWinRTLibs>
21
+ <BuildMSRNCxxModule>false</BuildMSRNCxxModule>
21
22
  <BuildMSRNCxxReactCommon>false</BuildMSRNCxxReactCommon>
22
23
  <DesktopCompatible Condition="'$(UseWinUI3)'=='true'">true</DesktopCompatible>
23
24
  </PropertyGroup>
@@ -184,7 +185,6 @@
184
185
  <ItemGroup>
185
186
  <ClInclude Include="ABICxxModule.h" />
186
187
  <ClInclude Include="ABIViewManager.h" />
187
- <ClInclude Include="Base\CoreNativeModules.h" />
188
188
  <ClInclude Include="Base\CxxReactIncludes.h" />
189
189
  <ClInclude Include="Base\FollyIncludes.h" />
190
190
  <ClInclude Include="CoreAppPage.h">
@@ -220,9 +220,6 @@
220
220
  <DependentUpon>IReactNotificationService.idl</DependentUpon>
221
221
  <SubType>Code</SubType>
222
222
  </ClInclude>
223
- <ClInclude Include="JsiApi.h">
224
- <DependentUpon>JsiApi.idl</DependentUpon>
225
- </ClInclude>
226
223
  <ClInclude Include="JsiReader.h">
227
224
  <DependentUpon>IJSValueReader.idl</DependentUpon>
228
225
  </ClInclude>
@@ -422,7 +419,6 @@
422
419
  <ItemGroup>
423
420
  <ClCompile Include="ABICxxModule.cpp" />
424
421
  <ClCompile Include="ABIViewManager.cpp" />
425
- <ClCompile Include="Base\CoreNativeModules.cpp" />
426
422
  <ClCompile Include="Base\CoreUIManagers.cpp" />
427
423
  <ClCompile Include="CoreAppPage.cpp">
428
424
  <DependentUpon>CoreAppPage.xaml</DependentUpon>
@@ -747,7 +743,7 @@
747
743
  <ItemGroup>
748
744
  <PackageReference Include="boost" Version="1.76.0.0" />
749
745
  <PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
750
- <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" />
746
+ <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" />
751
747
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
752
748
  <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
753
749
  </ItemGroup>
@@ -795,4 +791,4 @@
795
791
  </ClCompile>
796
792
  </ItemGroup>
797
793
  </Target>
798
- </Project>
794
+ </Project>
@@ -47,9 +47,6 @@
47
47
  <ClCompile Include="RedBox.cpp" />
48
48
  <ClCompile Include="TestHook.cpp" />
49
49
  <ClCompile Include="ViewManagersProvider.cpp" />
50
- <ClCompile Include="Base\CoreNativeModules.cpp">
51
- <Filter>Base</Filter>
52
- </ClCompile>
53
50
  <ClCompile Include="Base\CoreUIManagers.cpp">
54
51
  <Filter>Base</Filter>
55
52
  </ClCompile>
@@ -403,9 +400,6 @@
403
400
  <ClInclude Include="RedBox.h" />
404
401
  <ClInclude Include="TestHook.h" />
405
402
  <ClInclude Include="ViewManagersProvider.h" />
406
- <ClInclude Include="Base\CoreNativeModules.h">
407
- <Filter>Base</Filter>
408
- </ClInclude>
409
403
  <ClInclude Include="Modules\AccessibilityInfoModule.h">
410
404
  <Filter>Modules</Filter>
411
405
  </ClInclude>
@@ -678,7 +672,6 @@
678
672
  <ClInclude Include="Views\IXamlRootView.h">
679
673
  <Filter>Views</Filter>
680
674
  </ClInclude>
681
- <ClInclude Include="JsiApi.h" />
682
675
  <ClInclude Include="RedBoxErrorInfo.h" />
683
676
  <ClInclude Include="RedBoxErrorFrameInfo.h" />
684
677
  <ClInclude Include="Views\Image\Effects.h">
@@ -6,7 +6,6 @@
6
6
  #include "MsoUtils.h"
7
7
 
8
8
  #include <AppModelHelpers.h>
9
- #include <Base/CoreNativeModules.h>
10
9
  #include <Threading/MessageDispatchQueue.h>
11
10
  #include <Threading/MessageQueueThreadFactory.h>
12
11
  #include <appModel.h>
@@ -30,7 +29,6 @@
30
29
  #include <QuirkSettings.h>
31
30
  #include <Shared/DevServerHelper.h>
32
31
  #include <Views/ViewManager.h>
33
- #include <base/CoreNativeModules.h>
34
32
  #include <dispatchQueue/dispatchQueue.h>
35
33
  #include "DynamicWriter.h"
36
34
  #ifndef CORE_ABI
@@ -65,12 +63,12 @@
65
63
  #include <Utils/UwpScriptStore.h>
66
64
  #endif
67
65
 
66
+ #include "BaseScriptStoreImpl.h"
68
67
  #include "HermesRuntimeHolder.h"
69
68
 
70
69
  #if defined(USE_V8)
71
70
  #include <winrt/Windows.Storage.h>
72
- #include "BaseScriptStoreImpl.h"
73
- #include "V8JSIRuntimeHolder.h"
71
+ #include "JSI/V8RuntimeHolder.h"
74
72
  #endif // USE_V8
75
73
 
76
74
  #include "RedBox.h"
@@ -78,6 +76,8 @@
78
76
  #include <tuple>
79
77
  #include "ChakraRuntimeHolder.h"
80
78
 
79
+ #include <CreateModules.h>
80
+ #include <Utils/Helpers.h>
81
81
  #include "CrashManager.h"
82
82
  #include "JsiApi.h"
83
83
  #include "ReactCoreInjection.h"
@@ -246,6 +246,7 @@ 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);
249
250
  if (onDestroyed) {
250
251
  onDestroyed.Get()->Invoke(reactContext);
251
252
  }
@@ -371,6 +372,16 @@ void ReactInstanceWin::LoadModules(
371
372
  registerTurboModule(
372
373
  L"Timing", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::Timing>());
373
374
  #endif
375
+
376
+ registerTurboModule(::Microsoft::React::GetBlobTurboModuleName(), ::Microsoft::React::GetBlobModuleProvider());
377
+
378
+ registerTurboModule(::Microsoft::React::GetHttpTurboModuleName(), ::Microsoft::React::GetHttpModuleProvider());
379
+
380
+ registerTurboModule(
381
+ ::Microsoft::React::GetFileReaderTurboModuleName(), ::Microsoft::React::GetFileReaderModuleProvider());
382
+
383
+ registerTurboModule(
384
+ ::Microsoft::React::GetWebSocketTurboModuleName(), ::Microsoft::React::GetWebSocketModuleProvider());
374
385
  }
375
386
 
376
387
  //! Initialize() is called from the native queue.
@@ -438,15 +449,7 @@ void ReactInstanceWin::Initialize() noexcept {
438
449
  };
439
450
  #endif
440
451
 
441
- #ifdef CORE_ABI
442
452
  std::vector<facebook::react::NativeModuleDescription> cxxModules;
443
- #else
444
- // Acquire default modules and then populate with custom modules.
445
- // Note that some of these have custom thread affinity.
446
- std::vector<facebook::react::NativeModuleDescription> cxxModules =
447
- Microsoft::ReactNative::GetCoreModules(m_batchingUIThread, m_jsMessageThread.Load(), m_reactContext);
448
- #endif
449
-
450
453
  auto nmp = std::make_shared<winrt::Microsoft::ReactNative::NativeModulesProvider>();
451
454
 
452
455
  LoadModules(nmp, m_options.TurboModuleProvider);
@@ -465,10 +468,26 @@ void ReactInstanceWin::Initialize() noexcept {
465
468
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
466
469
 
467
470
  switch (m_options.JsiEngine()) {
468
- case JSIEngine::Hermes:
469
- devSettings->jsiRuntimeHolder =
470
- std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
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;
471
489
  break;
490
+ }
472
491
  case JSIEngine::V8:
473
492
  #if defined(USE_V8)
474
493
  {
@@ -482,10 +501,16 @@ void ReactInstanceWin::Initialize() noexcept {
482
501
  std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
483
502
  }
484
503
  }
485
- }
486
- devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
487
- devSettings, m_jsMessageThread.Load(), std::move(scriptStore), std::move(preparedScriptStore));
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);
488
512
  break;
513
+ }
489
514
  #endif // USE_V8
490
515
  case JSIEngine::Chakra:
491
516
  #ifndef CORE_ABI
@@ -1068,13 +1093,10 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1068
1093
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1069
1094
  }
1070
1095
 
1071
- #if defined(USE_V8)
1072
1096
  std::string ReactInstanceWin::getApplicationTempFolder() {
1073
1097
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1074
-
1075
1098
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1076
1099
  }
1077
- #endif
1078
1100
 
1079
1101
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1080
1102
  return m_useWebDebugger;
@@ -136,9 +136,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
136
136
  folly::dynamic Args;
137
137
  };
138
138
 
139
- #if defined(USE_V8)
140
139
  static std::string getApplicationTempFolder();
141
- #endif
142
140
 
143
141
  private: // immutable fields
144
142
  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();
213
+ Microsoft::ReactNative::HermesSamplingProfiler::Start(strongThis->m_context);
214
214
  } else {
215
- auto traceFilePath = co_await Microsoft::ReactNative::HermesSamplingProfiler::Stop();
215
+ auto traceFilePath = co_await Microsoft::ReactNative::HermesSamplingProfiler::Stop(strongThis->m_context);
216
216
  auto uiDispatcher =
217
217
  React::implementation::ReactDispatcher::GetUIDispatcher(strongThis->m_context->Properties());
218
218
  uiDispatcher.Post([traceFilePath]() {
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "ApiLoaders/NodeApi.h"
5
+
6
+ namespace Microsoft::NodeApiJsi {
7
+
8
+ LibHandle LibLoader::loadLib(const char * /*libName*/) {
9
+ return reinterpret_cast<LibHandle>(0);
10
+ }
11
+
12
+ FuncPtr LibLoader::getFuncPtr(LibHandle /*libHandle*/, const char * /*funcName*/) {
13
+ return reinterpret_cast<FuncPtr>(0);
14
+ }
15
+
16
+ } // namespace Microsoft::NodeApiJsi
@@ -14,6 +14,14 @@
14
14
  <TurboModule_SourcePath Condition="'$(TurboModule_SourcePath)' == '' AND Exists('$(MSBuildThisFileDirectory)ReactCommon\TurboModule.h')">$(MSBuildThisFileDirectory)</TurboModule_SourcePath>
15
15
  <Bridging_SourcePath Condition="'$(Bridging_SourcePath)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\ReactCommon\react\bridging</Bridging_SourcePath>
16
16
  <Bridging_SourcePath Condition="'$(Bridging_SourcePath)' == '' AND Exists('$(MSBuildThisFileDirectory)ReactCommon\CallbackWrapper.h')">$(MSBuildThisFileDirectory)ReactCommon</Bridging_SourcePath>
17
+
18
+ <NodeApiJsiCommitHash>53b897b03c1c7e57c3372acc6234447a44e150d6</NodeApiJsiCommitHash>
19
+ <NodeApiJsiLocal Condition="Exists('$(MSBuildThisFileDirectory)NodeApiJsiRuntime.cpp')">true</NodeApiJsiLocal>
20
+ <NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(NodeApiJsiLocal)' == 'true'">$(MSBuildThisFileDirectory)</NodeApiJsiDir>
21
+ <NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\..\..\node_modules\.node-api-jsi\node-api-jsi-$(NodeApiJsiCommitHash)\</NodeApiJsiDir>
22
+ <NodeApiJsiSrcDir Condition="'$(NodeApiJsiSrcDir)' == '' AND '$(NodeApiJsiLocal)' != 'true'">$(NodeApiJsiDir)src\</NodeApiJsiSrcDir>
23
+ <NodeApiJsiSrcDir Condition="'$(NodeApiJsiSrcDir)' == ''">$(MSBuildThisFileDirectory)</NodeApiJsiSrcDir>
24
+ <NodeApiDir Condition="'$(NodeApiDir)' == ''">$(NodeApiJsiDir)node-api\</NodeApiDir>
17
25
  </PropertyGroup>
18
26
  <ItemDefinitionGroup>
19
27
  <ClCompile>
@@ -23,8 +31,11 @@
23
31
  $(CallInvoker_SourcePath);
24
32
  $(TurboModule_SourcePath);
25
33
  $(Bridging_SourcePath);
34
+ $(NodeApiDir);
35
+ $(NodeApiJsiSrcDir);
26
36
  %(AdditionalIncludeDirectories)
27
37
  </AdditionalIncludeDirectories>
38
+ <PreprocessorDefinitions>JSI_VERSION=9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
28
39
  </ClCompile>
29
40
  <Midl>
30
41
  <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -40,7 +51,6 @@
40
51
  <ClInclude Include="$(MSBuildThisFileDirectory)CoreApp.h" />
41
52
  <ClInclude Include="$(MSBuildThisFileDirectory)DesktopWindowBridge.h" />
42
53
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\LongLivedJsiValue.h" />
43
- <ClInclude Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.h" />
44
54
  <ClInclude Include="$(MSBuildThisFileDirectory)TurboModuleProvider.h" />
45
55
  <ClInclude Include="$(CallInvoker_SourcePath)\ReactCommon\CallInvoker.h" />
46
56
  <ClInclude Include="$(MSBuildThisFileDirectory)XamlUtils.h" />
@@ -90,6 +100,14 @@
90
100
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Media.Media3D.h" />
91
101
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Navigation.h" />
92
102
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Shapes.h" />
103
+ <ClInclude Include="$(NodeApiDir)js_native_api.h" />
104
+ <ClInclude Include="$(NodeApiDir)js_native_api_types.h" />
105
+ <ClInclude Include="$(NodeApiDir)js_runtime_api.h" />
106
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.h" />
107
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.inc" />
108
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.h" />
109
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.inc" />
110
+ <ClInclude Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.h" />
93
111
  </ItemGroup>
94
112
  <ItemGroup Condition="'$(BuildMSRNCxx)' != 'false'">
95
113
  <ClCompile Include="$(MSBuildThisFileDirectory)JSI\JsiAbiApi.cpp" />
@@ -102,16 +120,18 @@
102
120
  <ClCompile Include="$(MSBuildThisFileDirectory)ReactPromise.cpp" />
103
121
  <ClCompile Include="$(MSBuildThisFileDirectory)TurboModuleProvider.cpp" />
104
122
  </ItemGroup>
105
- <ItemGroup Condition="'$(BuildMSRNCxx)' != 'false' and '$(BuildMSRNCxxReactCommon)' != 'false'">
106
- <!--
107
- Make sure all FB code uses the same flags to improve build parallelism.
108
- This is because msbuild has to invoke different cl.exe invocations for each
109
- set of flags and msbuild inside a project is single threaded.
110
- -->
123
+ <ItemGroup Condition="'$(BuildMSRNCxxJsi)' != 'false'">
111
124
  <ClCompile Include="$(JSI_SourcePath)\jsi\jsi.cpp">
112
125
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
113
126
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
114
127
  </ClCompile>
128
+ </ItemGroup>
129
+ <ItemGroup Condition="'$(BuildMSRNCxxReactCommon)' != 'false'">
130
+ <!--
131
+ Make sure all Meta code uses the same flags to improve build parallelism.
132
+ This is because msbuild has to invoke different cl.exe invocations for each
133
+ set of flags and msbuild inside a project is single threaded.
134
+ -->
115
135
  <ClCompile Include="$(Bridging_SourcePath)\LongLivedObject.cpp">
116
136
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
117
137
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
@@ -125,12 +145,23 @@
125
145
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
126
146
  </ClCompile>
127
147
  </ItemGroup>
128
- <ItemGroup>
129
- <None Include="$(MSBuildThisFileDirectory)README.md" />
148
+ <ItemGroup Condition="'$(BuildMSRNCxxNodeApiJsi)' != 'false'">
149
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.cpp">
150
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
151
+ </ClCompile>
152
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.cpp">
153
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
154
+ </ClCompile>
155
+ <ClCompile Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.cpp">
156
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
157
+ </ClCompile>
130
158
  </ItemGroup>
131
- <ItemGroup>
132
- <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.cpp">
133
- <ExcludedFromBuild Condition="'$(UseV8)' != 'true'">true</ExcludedFromBuild>
159
+ <ItemGroup Condition="'$(BuildMSRNCxxNodeApiJsiLoader)' != 'false'">
160
+ <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiLoader.cpp">
161
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
134
162
  </ClCompile>
135
163
  </ItemGroup>
164
+ <ItemGroup>
165
+ <None Include="$(MSBuildThisFileDirectory)README.md" />
166
+ </ItemGroup>
136
167
  </Project>
@@ -27,10 +27,13 @@
27
27
  <ClCompile Include="$(MSBuildThisFileDirectory)JSI\JsiApiContext.cpp">
28
28
  <Filter>JSI</Filter>
29
29
  </ClCompile>
30
- <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.cpp">
31
- <Filter>JSI</Filter>
32
- </ClCompile>
33
30
  <ClCompile Include="$(Bridging_SourcePath)\LongLivedObject.cpp" />
31
+ <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiLoader.cpp">
32
+ <Filter>NodeApiJsi</Filter>
33
+ </ClCompile>
34
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.cpp" />
35
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.cpp" />
36
+ <ClCompile Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.cpp" />
34
37
  </ItemGroup>
35
38
  <ItemGroup>
36
39
  <ClInclude Include="$(MSBuildThisFileDirectory)Crash.h" />
@@ -153,14 +156,19 @@
153
156
  <ClInclude Include="$(MSBuildThisFileDirectory)XamlUtils.h">
154
157
  <Filter>UI</Filter>
155
158
  </ClInclude>
156
- <ClInclude Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.h">
157
- <Filter>JSI</Filter>
158
- </ClInclude>
159
159
  <ClInclude Include="$(Bridging_SourcePath)\CallbackWrapper.h" />
160
160
  <ClInclude Include="$(MSBuildThisFileDirectory)CoreApp.h" />
161
161
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\LongLivedJsiValue.h">
162
162
  <Filter>TurboModule</Filter>
163
163
  </ClInclude>
164
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.h" />
165
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.inc" />
166
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.h" />
167
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.inc" />
168
+ <ClInclude Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.h" />
169
+ <ClInclude Include="$(NodeApiDir)js_native_api.h" />
170
+ <ClInclude Include="$(NodeApiDir)js_native_api_types.h" />
171
+ <ClInclude Include="$(NodeApiDir)js_runtime_api.h" />
164
172
  </ItemGroup>
165
173
  <ItemGroup>
166
174
  <Filter Include="JSI">
@@ -172,6 +180,9 @@
172
180
  <Filter Include="TurboModule">
173
181
  <UniqueIdentifier>{b5c0294c-d72f-44fa-8509-369f7d3e4a56}</UniqueIdentifier>
174
182
  </Filter>
183
+ <Filter Include="NodeApiJsi">
184
+ <UniqueIdentifier>{a34cd50a-190c-4cbb-8fe1-6ff1e16fe389}</UniqueIdentifier>
185
+ </Filter>
175
186
  </ItemGroup>
176
187
  <ItemGroup>
177
188
  <None Include="$(MSBuildThisFileDirectory)README.md" />
@@ -19,7 +19,7 @@
19
19
  <!-- WinUI package name and version are set by WinUI.props -->
20
20
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
21
21
  <!-- Hermes version is set by JSEngine.props -->
22
- <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" Condition="$(UseHermes)" />
22
+ <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" Condition="$(UseHermes)" />
23
23
  </ItemGroup>
24
24
 
25
25
  <Import Project="$(ReactNativeWindowsDir)PropertySheets\ManagedCodeGen\Microsoft.ReactNative.Managed.CodeGen.targets"
@@ -19,7 +19,7 @@
19
19
  <!-- WinUI package name and version are set by WinUI.props -->
20
20
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
21
21
  <!-- Hermes version is set by JSEngine.props -->
22
- <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" Condition="$(UseHermes)" />
22
+ <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" Condition="$(UseHermes)" />
23
23
  </ItemGroup>
24
24
 
25
25
  <!-- The props file for bundling is not set up to be just defaults, it assumes to be run at the end of the project. -->
@@ -24,7 +24,7 @@
24
24
  <!-- WinUI package name and version are set by WinUI.props -->
25
25
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
26
26
  <!-- Hermes version is set by JSEngine.props -->
27
- <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" Condition="$(UseHermes)" />
27
+ <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" Condition="$(UseHermes)" />
28
28
  </ItemGroup>
29
29
 
30
30
  <!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.71.24</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.71.25</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>71</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>24</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>25</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>08c3acfdfe4d3c66f15e24ef3dc795dcf39202c5</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>4a0a6e0ec375d51e84b3dfb1a02adc920cb42ad2</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -14,9 +14,9 @@
14
14
  <!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
15
15
  <UseHermes Condition="'$(UseHermes)' == ''">false</UseHermes>
16
16
  <!-- This will be true if (1) the client want to use hermes by setting UseHermes to true OR (2) We are building for UWP where dynamic switching is enabled -->
17
- <HermesVersion Condition="'$(HermesVersion)' == ''">0.71.1</HermesVersion>
18
- <HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgReactNative_Hermes_Windows)')">$(PkgReactNative_Hermes_Windows)</HermesPackage>
19
- <HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\ReactNative.Hermes.Windows\$(HermesVersion)</HermesPackage>
17
+ <HermesVersion Condition="'$(HermesVersion)' == ''">0.1.15</HermesVersion>
18
+ <HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgMicrosoft_JavaScript_Hermes)')">$(PkgMicrosoft_JavaScript_Hermes)</HermesPackage>
19
+ <HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\Microsoft.JavaScript.Hermes\$(HermesVersion)</HermesPackage>
20
20
  <EnableHermesInspectorInReleaseFlavor Condition="'$(EnableHermesInspectorInReleaseFlavor)' == ''">false</EnableHermesInspectorInReleaseFlavor>
21
21
  <!-- Disable linking Hermes into the output in cases where we need to fully rely on HermesShim -->
22
22
  <HermesNoLink Condition="'$(HermesNoLink)' == '' and '$(Configuration)' == 'Release' and '$(EnableHermesInspectorInReleaseFlavor)' != 'true'">true</HermesNoLink>
@@ -24,7 +24,7 @@
24
24
  <EnableDevServerHBCBundles Condition="'$(EnableDevServerHBCBundles)' == ''">false</EnableDevServerHBCBundles>
25
25
 
26
26
  <UseV8 Condition="'$(UseV8)' == ''">false</UseV8>
27
- <V8Version Condition="'$(V8Version)' == ''">0.71.3</V8Version>
27
+ <V8Version Condition="'$(V8Version)' == ''">0.71.5</V8Version>
28
28
  <V8PackageName>ReactNative.V8Jsi.Windows</V8PackageName>
29
29
  <V8PackageName Condition="'$(V8AppPlatform)' != 'win32'">$(V8PackageName).UWP</V8PackageName>
30
30
  <V8Package>$(NuGetPackageRoot)\$(V8PackageName).$(V8Version)</V8Package>
@@ -20,9 +20,8 @@
20
20
  <Import Project="$(MSBuildThisFileDirectory)NuGet.Cpp.props" />
21
21
 
22
22
  <PropertyGroup Label="Desktop">
23
- <!-- See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -->
24
- <WinVer>_WIN32_WINNT_WINBLUE</WinVer>
25
- <EnableBeast Condition="'$(EnableBeast)' == ''">0</EnableBeast>
23
+ <!-- See https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -->
24
+ <WinVer Condition="'$(WinVer)' == ''">_WIN32_WINNT_WIN10</WinVer>
26
25
  </PropertyGroup>
27
26
 
28
27
  <PropertyGroup>
@@ -57,6 +56,7 @@
57
56
  <PreprocessorDefinitions Condition="'$(EnableDevServerHBCBundles)'=='true'">ENABLE_DEVSERVER_HBCBUNDLES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
58
57
  <PreprocessorDefinitions Condition="'$(UseV8)'=='true'">USE_V8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
59
58
  <PreprocessorDefinitions Condition="'$(UseFabric)'=='true'">USE_FABRIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
59
+ <PreprocessorDefinitions>JSI_VERSION=9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
60
60
  </ClCompile>
61
61
  </ItemDefinitionGroup>
62
62
 
@@ -34,6 +34,12 @@
34
34
  <TreatWarningAsError>true</TreatWarningAsError>
35
35
  <WarningLevel>Level4</WarningLevel>
36
36
  </ClCompile>
37
+ <Link>
38
+ <!--
39
+ LNK4199: /DELAYLOAD:v8jsi.dll ignored; no imports found from v8jsi.dll
40
+ -->
41
+ <AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
42
+ </Link>
37
43
  </ItemDefinitionGroup>
38
44
 
39
45
  </Project>