react-native-windows 0.72.0-preview.7 → 0.72.0-preview.8

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 (43) hide show
  1. package/Directory.Build.props +24 -19
  2. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -4
  3. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +2 -57
  4. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +22 -17
  5. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -2
  6. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +16 -0
  7. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +41 -12
  8. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +17 -6
  9. package/Microsoft.ReactNative.Managed/packages.lock.json +6 -6
  10. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  11. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  12. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  13. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  14. package/PropertySheets/JSEngine.props +4 -4
  15. package/PropertySheets/Warnings.props +6 -0
  16. package/ReactCommon/ReactCommon.vcxproj +53 -1
  17. package/ReactCommon/cgmanifest.json +15 -0
  18. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +36 -0
  19. package/Shared/DevSupportManager.cpp +2 -9
  20. package/Shared/DevSupportManager.h +2 -6
  21. package/Shared/HermesRuntimeHolder.cpp +318 -81
  22. package/Shared/HermesRuntimeHolder.h +15 -19
  23. package/Shared/HermesSamplingProfiler.cpp +5 -6
  24. package/Shared/InspectorPackagerConnection.cpp +62 -108
  25. package/Shared/InspectorPackagerConnection.h +9 -21
  26. package/Shared/JSI/ScriptStore.h +18 -20
  27. package/Shared/JSI/V8RuntimeHolder.cpp +262 -0
  28. package/Shared/JSI/V8RuntimeHolder.h +37 -0
  29. package/Shared/OInstance.cpp +16 -36
  30. package/Shared/SafeLoadLibrary.cpp +41 -0
  31. package/Shared/SafeLoadLibrary.h +15 -0
  32. package/Shared/Shared.vcxitems +21 -10
  33. package/Shared/Shared.vcxitems.filters +23 -30
  34. package/package.json +2 -2
  35. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  36. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +0 -2105
  37. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +0 -73
  38. package/Shared/HermesShim.cpp +0 -122
  39. package/Shared/HermesShim.h +0 -41
  40. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +0 -209
  41. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +0 -46
  42. package/Shared/V8JSIRuntimeHolder.cpp +0 -71
  43. package/Shared/V8JSIRuntimeHolder.h +0 -58
@@ -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" />
@@ -176,6 +178,52 @@
176
178
  <ItemGroup>
177
179
  <PackageReference Include="boost" Version="1.76.0.0" />
178
180
  </ItemGroup>
181
+ <PropertyGroup>
182
+ <NodeApiJsiZipDir>$(NodeApiJsiDir)..\.node-api-jsi-zip</NodeApiJsiZipDir>
183
+ <NodeApiJsiZipFile>$(NodeApiJsiZipDir)\node-api-jsi-$(NodeApiJsiCommitHash).zip</NodeApiJsiZipFile>
184
+ <CGManifestFile>$(MSBuildThisFileDirectory)cgmanifest.json</CGManifestFile>
185
+ </PropertyGroup>
186
+ <Target Name="DownloadNodeApiJsi" BeforeTargets="PrepareForBuild" Inputs="$(NodeApiJsiZipFile)" Outputs="$(NodeApiJsiZipFile)">
187
+ <Message Text="Downloading node-api-jsi..." Importance="High" />
188
+ <DownloadFile
189
+ SourceUrl="https://github.com/microsoft/node-api-jsi/archive/$(NodeApiJsiCommitHash).zip"
190
+ DestinationFileName="$(NodeApiJsiZipFile)"
191
+ DestinationFolder="$(NodeApiJsiZipDir)"
192
+ Retries="10" />
193
+ </Target>
194
+ <Target Name="UnzipNodeApiJsi" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadNodeApiJsi">
195
+ <Message Text="Unzipping node-api-jsi to $([MSBuild]::NormalizePath($(NodeApiJsiDir)..))." Importance="High"
196
+ Condition="!Exists('$(NodeApiJsiDir)src\NodeApiJsiRuntime.h')" />
197
+ <Unzip
198
+ Condition="!Exists('$(NodeApiJsiDir)src\NodeApiJsiRuntime.h')"
199
+ SourceFiles="$(NodeApiJsiZipFile)"
200
+ DestinationFolder="$([MSBuild]::NormalizePath($(NodeApiJsiDir)..))"
201
+ OverwriteReadOnlyFiles="true" />
202
+ </Target>
203
+ <Target Name="WriteCGManifest" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadNodeApiJsi" Inputs="$(NodeApiJsiZipFile)" Outputs="$(CGManifestFile)">
204
+ <PropertyGroup>
205
+ <CGManifestText>{
206
+ "$schema": "https://json.schemastore.org/component-detection-manifest.json",
207
+ "Registrations": [
208
+ {
209
+ "Component": {
210
+ "Type": "git",
211
+ "Git": {
212
+ "RepositoryUrl": "https://github.com/microsoft/node-api-jsi",
213
+ "CommitHash": "$(NodeApiJsiCommitHash)"
214
+ }
215
+ },
216
+ "DevelopmentDependency": false
217
+ }
218
+ ]
219
+ }</CGManifestText>
220
+ </PropertyGroup>
221
+ <Message Text="Generating $(CGManifestFile)." Importance="High" />
222
+ <WriteLinesToFile
223
+ File="$(CGManifestFile)"
224
+ Overwrite="true"
225
+ Lines="$(CGManifestText)" />
226
+ </Target>
179
227
  <Target Name="EnsureNodeModuleBuildImports" BeforeTargets="PrepareForBuild">
180
228
  <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." />
181
229
  <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." />
@@ -185,7 +233,11 @@
185
233
  </ItemGroup>
186
234
  <Target Name="Deploy" />
187
235
  <!-- Reenable this task if we need to temporarily replace any folly files for fixes, while we wait for PRs to land in folly -->
188
- <Target Name="ApplyReactCommonTemporaryPatch" BeforeTargets="PrepareForBuild">
236
+ <Target Name="ApplyReactCommonTemporaryPatch" BeforeTargets="PrepareForBuild" DependsOnTargets="UnzipNodeApiJsi">
237
+ <ItemGroup>
238
+ <NodeApiJsiFiles Include="$([MSBuild]::NormalizePath($(NodeApiJsiDir)..))\jsi\**\*.*" />
239
+ </ItemGroup>
240
+ <Copy DestinationFiles="@(NodeApiJsiFiles->'$(ReactNativeDir)\ReactCommon\jsi\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(NodeApiJsiFiles)" />
189
241
  <Copy DestinationFiles="@(TemporaryReactCommonPatchFiles->'$(ReactNativeDir)\ReactCommon\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(TemporaryReactCommonPatchFiles)" />
190
242
  </Target>
191
243
  </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\
@@ -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