react-native-windows 0.71.23 → 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 +3 -3
  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
@@ -106,6 +106,7 @@
106
106
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\SystraceSection.h" />
107
107
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.h" />
108
108
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.h" />
109
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector\InspectorInterfaces.h" />
109
110
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\logger\react_native_log.h" />
110
111
  <ClInclude Include="$(YogaDir)\yoga\YGEnums.h" />
111
112
  <ClInclude Include="$(YogaDir)\yoga\YGMacros.h" />
@@ -127,6 +128,7 @@
127
128
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsi\jsi\JSIDynamic.cpp" />
128
129
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.cpp" />
129
130
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.cpp" />
131
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector\InspectorInterfaces.cpp" />
130
132
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\logger\react_native_log.cpp" />
131
133
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\reactperflogger\BridgeNativeModulePerfLogger.cpp" />
132
134
  <ClCompile Include="$(YogaDir)\yoga\log.cpp" />
@@ -178,6 +180,52 @@
178
180
  <ItemGroup>
179
181
  <PackageReference Include="boost" Version="1.76.0.0" />
180
182
  </ItemGroup>
183
+ <PropertyGroup>
184
+ <NodeApiJsiZipDir>$(NodeApiJsiDir)..\.node-api-jsi-zip</NodeApiJsiZipDir>
185
+ <NodeApiJsiZipFile>$(NodeApiJsiZipDir)\node-api-jsi-$(NodeApiJsiCommitHash).zip</NodeApiJsiZipFile>
186
+ <CGManifestFile>$(MSBuildThisFileDirectory)cgmanifest.json</CGManifestFile>
187
+ </PropertyGroup>
188
+ <Target Name="DownloadNodeApiJsi" BeforeTargets="PrepareForBuild" Inputs="$(NodeApiJsiZipFile)" Outputs="$(NodeApiJsiZipFile)">
189
+ <Message Text="Downloading node-api-jsi..." Importance="High" />
190
+ <DownloadFile
191
+ SourceUrl="https://github.com/microsoft/node-api-jsi/archive/$(NodeApiJsiCommitHash).zip"
192
+ DestinationFileName="$(NodeApiJsiZipFile)"
193
+ DestinationFolder="$(NodeApiJsiZipDir)"
194
+ Retries="10" />
195
+ </Target>
196
+ <Target Name="UnzipNodeApiJsi" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadNodeApiJsi">
197
+ <Message Text="Unzipping node-api-jsi to $([MSBuild]::NormalizePath($(NodeApiJsiDir)..))." Importance="High"
198
+ Condition="!Exists('$(NodeApiJsiDir)src\NodeApiJsiRuntime.h')" />
199
+ <Unzip
200
+ Condition="!Exists('$(NodeApiJsiDir)src\NodeApiJsiRuntime.h')"
201
+ SourceFiles="$(NodeApiJsiZipFile)"
202
+ DestinationFolder="$([MSBuild]::NormalizePath($(NodeApiJsiDir)..))"
203
+ OverwriteReadOnlyFiles="true" />
204
+ </Target>
205
+ <Target Name="WriteCGManifest" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadNodeApiJsi" Inputs="$(NodeApiJsiZipFile)" Outputs="$(CGManifestFile)">
206
+ <PropertyGroup>
207
+ <CGManifestText>{
208
+ "$schema": "https://json.schemastore.org/component-detection-manifest.json",
209
+ "Registrations": [
210
+ {
211
+ "Component": {
212
+ "Type": "git",
213
+ "Git": {
214
+ "RepositoryUrl": "https://github.com/microsoft/node-api-jsi",
215
+ "CommitHash": "$(NodeApiJsiCommitHash)"
216
+ }
217
+ },
218
+ "DevelopmentDependency": false
219
+ }
220
+ ]
221
+ }</CGManifestText>
222
+ </PropertyGroup>
223
+ <Message Text="Generating $(CGManifestFile)." Importance="High" />
224
+ <WriteLinesToFile
225
+ File="$(CGManifestFile)"
226
+ Overwrite="true"
227
+ Lines="$(CGManifestText)" />
228
+ </Target>
181
229
  <Target Name="EnsureNodeModuleBuildImports" BeforeTargets="PrepareForBuild">
182
230
  <Error Condition="!Exists('$(ReactNativeDir)')" Text="This project references code in the node_modules folder that is missing on this computer. Use `yarn install` to download them." />
183
231
  <Error Condition="!Exists('$(YogaDir)')" Text="This project references code in the node_modules folder that is missing on this computer. Use `yarn install` to download them." />
@@ -187,7 +235,11 @@
187
235
  </ItemGroup>
188
236
  <Target Name="Deploy" />
189
237
  <!-- Reenable this task if we need to temporarily replace any folly files for fixes, while we wait for PRs to land in folly -->
190
- <Target Name="ApplyReactCommonTemporaryPatch" BeforeTargets="PrepareForBuild">
238
+ <Target Name="ApplyReactCommonTemporaryPatch" BeforeTargets="PrepareForBuild" DependsOnTargets="UnzipNodeApiJsi">
239
+ <ItemGroup>
240
+ <NodeApiJsiFiles Include="$([MSBuild]::NormalizePath($(NodeApiJsiDir)))\jsi\**\*.*" />
241
+ </ItemGroup>
242
+ <Copy DestinationFiles="@(NodeApiJsiFiles->'$(ReactNativeDir)\ReactCommon\jsi\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(NodeApiJsiFiles)" />
191
243
  <Copy DestinationFiles="@(TemporaryReactCommonPatchFiles->'$(ReactNativeDir)\ReactCommon\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(TemporaryReactCommonPatchFiles)" />
192
244
  </Target>
193
245
  </Project>
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/component-detection-manifest.json",
3
+ "Registrations": [
4
+ {
5
+ "Component": {
6
+ "Type": "git",
7
+ "Git": {
8
+ "RepositoryUrl": "https://github.com/microsoft/node-api-jsi",
9
+ "CommitHash": "53b897b03c1c7e57c3372acc6234447a44e150d6"
10
+ }
11
+ },
12
+ "DevelopmentDependency": false
13
+ }
14
+ ]
15
+ }
@@ -15,6 +15,23 @@ Write-Host "Destination root: [$TargetRoot]"
15
15
  Write-Host "React Native root: [$ReactNativeRoot]"
16
16
  Write-Host "ReactCommon Override root: [$ReactCommonOverrideRoot]"
17
17
 
18
+ [xml]$props = gc $PSScriptRoot\..\..\Directory.Build.props
19
+ [string] $NodeApiJsiCommitHash = $props.Project.PropertyGroup.NodeApiJsiCommitHash;
20
+ $NodeApiJsiCommitHash = $NodeApiJsiCommitHash.Trim()
21
+ $NodeApiJsiRoot = "$SourceRoot\node_modules\.node-api-jsi\node-api-jsi-${NodeApiJsiCommitHash}";
22
+ Write-Host "Node-API JSI root: [$NodeApiJsiRoot]"
23
+
24
+ # Download Node-API JSI if running on a machine which hasn't run native build logic to acquire it
25
+ if (!(Test-Path $NodeApiJsiRoot)) {
26
+ Write-Host "Downloading Node-API JSI $NodeApiJsiCommitHash"
27
+ $NodeApiJsiZip = "$SourceRoot\node_modules\.node-api-jsi\node-api-jsi-${NodeApiJsiCommitHash}.zip"
28
+ $NodeApiJsiDest = "$SourceRoot\node_modules\.node-api-jsi"
29
+
30
+ New-Item $NodeApiJsiRoot -ItemType Directory
31
+ Invoke-RestMethod -Uri "https://github.com/microsoft/node-api-jsi/archive/${NodeApiJsiCommitHash}.zip" -OutFile $NodeApiJsiZip
32
+ Expand-Archive -LiteralPath $NodeApiJsiZip -DestinationPath $NodeApiJsiDest
33
+ }
34
+
18
35
  md -Force $TargetRoot
19
36
 
20
37
  $patterns = $Extensions| ForEach-Object {"*.$_"}
@@ -39,6 +56,25 @@ Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi.h -Destination $
39
56
  Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi-inl.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
40
57
  Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\threadsafe.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
41
58
 
59
+ # Microsoft.ReactNative.CXX project Node-API files
60
+ New-Item $TargetRoot\Microsoft.ReactNative.Cxx\node-api -ItemType Directory -Force
61
+ Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_native_api.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\node-api\
62
+ Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_native_api_types.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\node-api\
63
+ Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_runtime_api.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\node-api\
64
+
65
+ # Microsoft.ReactNative.CXX project Node-API JSI files
66
+ New-Item $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders -ItemType Directory -Force
67
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\JSRuntimeApi.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
68
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\JSRuntimeApi.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
69
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\JSRuntimeApi.inc -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
70
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\NodeApi.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
71
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\NodeApi.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
72
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\NodeApi.inc -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
73
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\NodeApi_posix.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
74
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\ApiLoaders\NodeApi_win.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ApiLoaders\
75
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\NodeApiJsiRuntime.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\
76
+ Copy-Item -Force -Path $NodeApiJsiRoot\src\NodeApiJsiRuntime.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\
77
+
42
78
  # Microsoft.ReactNative.CXX project TurboModule files
43
79
  New-Item -ItemType Directory -Path $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon -Force
44
80
  Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\callinvoker\ReactCommon\CallInvoker.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
@@ -0,0 +1,95 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "BaseFileReaderResource.h"
5
+
6
+ // Boost Library
7
+ #include <boost/archive/iterators/base64_from_binary.hpp>
8
+ #include <boost/archive/iterators/ostream_iterator.hpp>
9
+ #include <boost/archive/iterators/transform_width.hpp>
10
+
11
+ // Windows API
12
+ #include <winrt/base.h>
13
+
14
+ using std::function;
15
+ using std::shared_ptr;
16
+ using std::string;
17
+
18
+ namespace Microsoft::React {
19
+
20
+ #pragma region BaseFileReaderResource
21
+
22
+ BaseFileReaderResource::BaseFileReaderResource(std::weak_ptr<IBlobPersistor> weakBlobPersistor) noexcept
23
+ : m_weakBlobPersistor{weakBlobPersistor} {}
24
+
25
+ #pragma region IFileReaderResource
26
+
27
+ void BaseFileReaderResource::ReadAsText(
28
+ string &&blobId,
29
+ int64_t offset,
30
+ int64_t size,
31
+ string &&encoding,
32
+ function<void(string &&)> &&resolver,
33
+ function<void(string &&)> &&rejecter) noexcept /*override*/ {
34
+ auto persistor = m_weakBlobPersistor.lock();
35
+ if (!persistor) {
36
+ return resolver("Could not find Blob persistor");
37
+ }
38
+
39
+ winrt::array_view<uint8_t const> bytes;
40
+ try {
41
+ bytes = persistor->ResolveMessage(std::move(blobId), offset, size);
42
+ } catch (const std::exception &e) {
43
+ return rejecter(e.what());
44
+ }
45
+
46
+ // #9982 - Handle non-UTF8 encodings
47
+ // See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/charset/Charset.html
48
+ auto result = string{bytes.cbegin(), bytes.cend()};
49
+
50
+ resolver(std::move(result));
51
+ }
52
+
53
+ void BaseFileReaderResource::ReadAsDataUrl(
54
+ string &&blobId,
55
+ int64_t offset,
56
+ int64_t size,
57
+ string &&type,
58
+ function<void(string &&)> &&resolver,
59
+ function<void(string &&)> &&rejecter) noexcept /*override*/ {
60
+ auto persistor = m_weakBlobPersistor.lock();
61
+ if (!persistor) {
62
+ return rejecter("Could not find Blob persistor");
63
+ }
64
+
65
+ winrt::array_view<uint8_t const> bytes;
66
+ try {
67
+ bytes = persistor->ResolveMessage(std::move(blobId), offset, size);
68
+ } catch (const std::exception &e) {
69
+ return rejecter(e.what());
70
+ }
71
+
72
+ auto result = string{"data:"};
73
+ result += type;
74
+ result += ";base64,";
75
+
76
+ // https://www.boost.org/doc/libs/1_76_0/libs/serialization/doc/dataflow.html
77
+ using namespace boost::archive::iterators;
78
+ typedef base64_from_binary<transform_width<const char *, 6, 8>> encode_base64;
79
+ std::ostringstream oss;
80
+ std::copy(encode_base64(bytes.cbegin()), encode_base64(bytes.cend()), ostream_iterator<char>(oss));
81
+ result += oss.str();
82
+
83
+ resolver(std::move(result));
84
+ }
85
+
86
+ /*static*/ shared_ptr<IFileReaderResource> IFileReaderResource::Make(
87
+ std::weak_ptr<IBlobPersistor> weakBlobPersistor) noexcept {
88
+ return std::make_shared<BaseFileReaderResource>(weakBlobPersistor);
89
+ }
90
+
91
+ #pragma endregion IFileReaderResource
92
+
93
+ #pragma endregion BaseFileReaderResource
94
+
95
+ } // namespace Microsoft::React
@@ -0,0 +1,41 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include "IFileReaderResource.h"
7
+
8
+ // Standard Library
9
+ #include <memory>
10
+
11
+ namespace Microsoft::React {
12
+
13
+ class BaseFileReaderResource : public IFileReaderResource, public std::enable_shared_from_this<BaseFileReaderResource> {
14
+ protected:
15
+ std::weak_ptr<IBlobPersistor> m_weakBlobPersistor;
16
+
17
+ public:
18
+ BaseFileReaderResource(std::weak_ptr<IBlobPersistor> weakBlobPersistor) noexcept;
19
+
20
+ #pragma region IFileReaderResource
21
+
22
+ void ReadAsText(
23
+ std::string &&blobId,
24
+ int64_t offset,
25
+ int64_t size,
26
+ std::string &&encoding,
27
+ std::function<void(std::string &&)> &&resolver,
28
+ std::function<void(std::string &&)> &&rejecter) noexcept override;
29
+
30
+ void ReadAsDataUrl(
31
+ std::string &&blobId,
32
+ int64_t offset,
33
+ int64_t size,
34
+ std::string &&type,
35
+ std::function<void(std::string &&)> &&resolver,
36
+ std::function<void(std::string &&)> &&rejecter) noexcept override;
37
+
38
+ #pragma endregion IFileReaderResource
39
+ };
40
+
41
+ } // namespace Microsoft::React
@@ -5,7 +5,6 @@
5
5
 
6
6
  // React Native
7
7
  #include <cxxreact/CxxModule.h>
8
- #include <smartPtr/cntPtr.h>
9
8
 
10
9
  // Windows API
11
10
  #include <winrt/Windows.Foundation.h>
@@ -14,12 +13,16 @@
14
13
  #include <memory>
15
14
 
16
15
  // Forward declarations. Desktop projects can not access <React.h>
16
+ namespace winrt::Microsoft::ReactNative {
17
+ struct ReactContext;
18
+ struct ReactModuleProvider;
19
+ } // namespace winrt::Microsoft::ReactNative
20
+
17
21
  namespace Mso::React {
18
22
  struct IReactContext;
19
23
  }
20
24
 
21
- namespace facebook {
22
- namespace react {
25
+ namespace facebook::react {
23
26
 
24
27
  class MessageQueueThread;
25
28
 
@@ -29,11 +32,12 @@ class MessageQueueThread;
29
32
  extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateTimingModule(
30
33
  const std::shared_ptr<facebook::react::MessageQueueThread> &nativeThread) noexcept;
31
34
 
32
- } // namespace react
33
- } // namespace facebook
35
+ } // namespace facebook::react
34
36
 
35
37
  namespace Microsoft::React {
36
38
 
39
+ #pragma region CxxModules
40
+
37
41
  extern const char *GetHttpModuleName() noexcept;
38
42
  extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule(
39
43
  winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
@@ -50,4 +54,22 @@ extern const char *GetFileReaderModuleName() noexcept;
50
54
  extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateFileReaderModule(
51
55
  winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
52
56
 
57
+ #pragma endregion CxxModules
58
+
59
+ #pragma region TurboModules
60
+
61
+ extern const wchar_t *GetBlobTurboModuleName() noexcept;
62
+ extern const winrt::Microsoft::ReactNative::ReactModuleProvider &GetBlobModuleProvider() noexcept;
63
+
64
+ extern const wchar_t *GetHttpTurboModuleName() noexcept;
65
+ extern const winrt::Microsoft::ReactNative::ReactModuleProvider &GetHttpModuleProvider() noexcept;
66
+
67
+ extern const wchar_t *GetFileReaderTurboModuleName() noexcept;
68
+ extern const winrt::Microsoft::ReactNative::ReactModuleProvider &GetFileReaderModuleProvider() noexcept;
69
+
70
+ extern const wchar_t *GetWebSocketTurboModuleName() noexcept;
71
+ extern const winrt::Microsoft::ReactNative::ReactModuleProvider &GetWebSocketModuleProvider() noexcept;
72
+
73
+ #pragma endregion TurboModules
74
+
53
75
  } // namespace Microsoft::React
@@ -21,10 +21,8 @@
21
21
  #include <winrt/Windows.Web.Http.Headers.h>
22
22
  #include <winrt/Windows.Web.Http.h>
23
23
 
24
- #ifdef HERMES_ENABLE_DEBUGGER
25
24
  #include <winrt/Windows.ApplicationModel.Activation.h>
26
25
  #include <winrt/Windows.Networking.Connectivity.h>
27
- #endif
28
26
 
29
27
  #pragma warning(push)
30
28
  #pragma warning(disable : 4068 4251 4101 4804 4309)
@@ -243,7 +241,6 @@ void DevSupportManager::StopPollingLiveReload() {
243
241
  void DevSupportManager::EnsureHermesInspector(
244
242
  [[maybe_unused]] const std::string &packagerHost,
245
243
  [[maybe_unused]] const uint16_t packagerPort) noexcept {
246
- #ifdef HERMES_ENABLE_DEBUGGER
247
244
  static std::once_flag once;
248
245
  std::call_once(once, [this, &packagerHost, packagerPort]() {
249
246
  // TODO: should we use the bundleAppId as the app param if available?
@@ -266,14 +263,10 @@ void DevSupportManager::EnsureHermesInspector(
266
263
  m_BundleStatusProvider);
267
264
  m_inspectorPackagerConnection->connectAsync();
268
265
  });
269
-
270
- #endif
271
266
  }
272
267
 
273
- void DevSupportManager::UpdateBundleStatus(bool isLastDownloadSucess, int64_t updateTimestamp) noexcept {
274
- #ifdef HERMES_ENABLE_DEBUGGER
275
- m_BundleStatusProvider->updateBundleStatus(isLastDownloadSucess, updateTimestamp);
276
- #endif
268
+ void DevSupportManager::UpdateBundleStatus(bool isLastDownloadSuccess, int64_t updateTimestamp) noexcept {
269
+ m_BundleStatusProvider->updateBundleStatus(isLastDownloadSuccess, updateTimestamp);
277
270
  }
278
271
 
279
272
  std::pair<std::string, bool> GetJavaScriptFromServer(
@@ -14,9 +14,7 @@
14
14
  #include <memory>
15
15
  #include <string>
16
16
 
17
- #if defined(HERMES_ENABLE_DEBUGGER)
18
17
  #include <InspectorPackagerConnection.h>
19
- #endif
20
18
 
21
19
  namespace facebook {
22
20
  namespace react {
@@ -57,7 +55,6 @@ class DevSupportManager final : public facebook::react::IDevSupportManager {
57
55
  private:
58
56
  std::atomic_bool m_cancellation_token;
59
57
 
60
- #if defined(HERMES_ENABLE_DEBUGGER)
61
58
  std::shared_ptr<InspectorPackagerConnection> m_inspectorPackagerConnection;
62
59
 
63
60
  struct BundleStatusProvider : public InspectorPackagerConnection::IBundleStatusProvider {
@@ -65,8 +62,8 @@ class DevSupportManager final : public facebook::react::IDevSupportManager {
65
62
  return m_bundleStatus;
66
63
  }
67
64
 
68
- void updateBundleStatus(bool isLastDownloadSucess, int64_t updateTimestamp) {
69
- m_bundleStatus.m_isLastDownloadSucess = isLastDownloadSucess;
65
+ void updateBundleStatus(bool isLastDownloadSuccess, int64_t updateTimestamp) {
66
+ m_bundleStatus.m_isLastDownloadSuccess = isLastDownloadSuccess;
70
67
  m_bundleStatus.m_updateTimestamp = updateTimestamp;
71
68
  }
72
69
 
@@ -74,7 +71,6 @@ class DevSupportManager final : public facebook::react::IDevSupportManager {
74
71
  InspectorPackagerConnection::BundleStatus m_bundleStatus;
75
72
  };
76
73
  std::shared_ptr<BundleStatusProvider> m_BundleStatusProvider = std::make_shared<BundleStatusProvider>();
77
- #endif
78
74
  };
79
75
 
80
76
  } // namespace Microsoft::ReactNative