react-native-windows 0.72.0-preview.6 → 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 (55) hide show
  1. package/Directory.Build.props +27 -21
  2. package/Microsoft.ReactNative/IReactContext.cpp +4 -0
  3. package/Microsoft.ReactNative/IReactContext.h +1 -0
  4. package/Microsoft.ReactNative/IReactContext.idl +6 -0
  5. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -4
  6. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +2 -57
  7. package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +7 -0
  8. package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +1 -0
  9. package/Microsoft.ReactNative/ReactHost/React.h +2 -0
  10. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +27 -17
  11. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -2
  12. package/Microsoft.ReactNative/ReactInstanceSettings.h +13 -0
  13. package/Microsoft.ReactNative/ReactInstanceSettings.idl +4 -0
  14. package/Microsoft.ReactNative/ReactNativeHost.cpp +1 -0
  15. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +16 -0
  16. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +41 -12
  17. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +17 -6
  18. package/Microsoft.ReactNative.Managed/ReactSettingsSnapshot.cs +2 -0
  19. package/Microsoft.ReactNative.Managed/packages.lock.json +6 -6
  20. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  21. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  22. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  23. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  24. package/PropertySheets/JSEngine.props +4 -4
  25. package/PropertySheets/NuGet.Cpp.props +3 -2
  26. package/PropertySheets/Warnings.props +6 -0
  27. package/ReactCommon/ReactCommon.vcxproj +53 -1
  28. package/ReactCommon/cgmanifest.json +15 -0
  29. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +36 -0
  30. package/Shared/DevSettings.h +3 -0
  31. package/Shared/DevSupportManager.cpp +2 -9
  32. package/Shared/DevSupportManager.h +2 -6
  33. package/Shared/HermesRuntimeHolder.cpp +318 -81
  34. package/Shared/HermesRuntimeHolder.h +15 -19
  35. package/Shared/HermesSamplingProfiler.cpp +5 -6
  36. package/Shared/InspectorPackagerConnection.cpp +62 -108
  37. package/Shared/InspectorPackagerConnection.h +9 -21
  38. package/Shared/JSI/ScriptStore.h +18 -20
  39. package/Shared/JSI/V8RuntimeHolder.cpp +262 -0
  40. package/Shared/JSI/V8RuntimeHolder.h +37 -0
  41. package/Shared/OInstance.cpp +20 -40
  42. package/Shared/SafeLoadLibrary.cpp +41 -0
  43. package/Shared/SafeLoadLibrary.h +15 -0
  44. package/Shared/Shared.vcxitems +21 -10
  45. package/Shared/Shared.vcxitems.filters +23 -30
  46. package/package.json +2 -2
  47. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  48. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +0 -2105
  49. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +0 -73
  50. package/Shared/HermesShim.cpp +0 -122
  51. package/Shared/HermesShim.h +0 -41
  52. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +0 -209
  53. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +0 -46
  54. package/Shared/V8JSIRuntimeHolder.cpp +0 -71
  55. package/Shared/V8JSIRuntimeHolder.h +0 -58
@@ -21,6 +21,30 @@
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
+ </PropertyGroup>
27
+
28
+ <!--
29
+ IMPORTANT: Traversals left in a directory will break some tools like midl, but we also cannot call
30
+ [MSBuild]::NormalizeDirectory on relative paths since cwd is not always correct. This logic should prefer to operate
31
+ on full paths and avoid extra normalization.
32
+ -->
33
+ <PropertyGroup>
34
+ <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$(MSBuildThisFileDirectory)</ReactNativeWindowsDir>
35
+
36
+ <ReactNativeDir Condition="'$(ReactNativeDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native\package.json'))\node_modules\react-native\</ReactNativeDir>
37
+
38
+ <YogaDir Condition="'$(YogaDir)' == ''">$(ReactNativeDir)ReactCommon\yoga</YogaDir>
39
+
40
+ <FollyDir Condition="'$(FollyDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.folly\folly-$(FollyVersion)</FollyDir>
41
+ <FollyDir>$([MSBuild]::NormalizeDirectory($(FollyDir)))</FollyDir>
42
+
43
+ <FmtDir Condition="'$(FmtDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.fmt\fmt-$(FmtVersion)</FmtDir>
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>
24
48
  </PropertyGroup>
25
49
 
26
50
  <PropertyGroup Label="Configuration">
@@ -46,28 +70,10 @@
46
70
  <OutputPath Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(OutDir)</OutputPath>
47
71
  </PropertyGroup>
48
72
 
49
- <!--
50
- IMPORTANT: Traversals left in a directory will break some tools like midl, but we also cannot call
51
- [MSBuild]::NormalizeDirectory on relative paths since cwd is not always correct. This logic should prefer to operate
52
- on full paths and avoid extra normalization.
53
- -->
54
- <PropertyGroup>
55
- <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$(MSBuildThisFileDirectory)</ReactNativeWindowsDir>
56
-
57
- <ReactNativeDir Condition="'$(ReactNativeDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native\package.json'))\node_modules\react-native\</ReactNativeDir>
58
-
59
- <YogaDir Condition="'$(YogaDir)' == ''">$(ReactNativeDir)ReactCommon\yoga</YogaDir>
60
-
61
- <FollyDir Condition="'$(FollyDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.folly\folly-$(FollyVersion)</FollyDir>
62
- <FollyDir>$([MSBuild]::NormalizeDirectory($(FollyDir)))</FollyDir>
63
-
64
- <FmtDir Condition="'$(FmtDir)' == '' AND Exists('$([MSBuild]::NormalizeDirectory($(ReactNativeDir)..\..\node_modules))')">$(ReactNativeDir)..\..\node_modules\.fmt\fmt-$(FmtVersion)</FmtDir>
65
- <FmtDir>$([MSBuild]::NormalizeDirectory($(FmtDir)))</FmtDir>
66
- </PropertyGroup>
67
-
68
73
  <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
69
- <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
70
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
74
+ <!-- See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target -->
75
+ <!-- RestoreUseStaticGraphEvaluation broke in VS 17.6, see https://github.com/microsoft/react-native-windows/issues/11670 -->
76
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND $([MSBuild]::VersionLessThan('$(MSBuildVersion)', '17.6')) AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
71
77
  </PropertyGroup>
72
78
 
73
79
  </Project>
@@ -65,6 +65,10 @@ hstring ReactSettingsSnapshot::BundleAppId() const noexcept {
65
65
  return winrt::to_hstring(m_settings->BundleAppId());
66
66
  }
67
67
 
68
+ bool ReactSettingsSnapshot::RequestDevBundle() const noexcept {
69
+ return m_settings->RequestDevBundle();
70
+ }
71
+
68
72
  Mso::React::IReactSettingsSnapshot const &ReactSettingsSnapshot::GetInner() const noexcept {
69
73
  return *m_settings;
70
74
  }
@@ -24,6 +24,7 @@ struct ReactSettingsSnapshot : winrt::implements<ReactSettingsSnapshot, IReactSe
24
24
  bool RequestInlineSourceMap() const noexcept;
25
25
  hstring JavaScriptBundleFile() const noexcept;
26
26
  hstring BundleAppId() const noexcept;
27
+ bool RequestDevBundle() const noexcept;
27
28
 
28
29
  public:
29
30
  // Internal accessor for within the Microsoft.ReactNative dll to allow calling into internal methods
@@ -125,6 +125,12 @@ namespace Microsoft.ReactNative
125
125
  "at the time when the React instance was created.\n"
126
126
  "The name of the app passed to the packager server via the 'app' query parameter.")
127
127
  String BundleAppId { get; };
128
+
129
+ DOC_STRING(
130
+ "A read-only snapshot of the @ReactInstanceSettings.RequestDevBundle property value "
131
+ "at the time when the React instance was created.\n"
132
+ "When querying the bundle server for a bundle, should it request the dev bundle or release bundle.")
133
+ Boolean RequestDevBundle { get; };
128
134
  }
129
135
 
130
136
  [webhosthidden]
@@ -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>
@@ -220,9 +221,6 @@
220
221
  <DependentUpon>IReactNotificationService.idl</DependentUpon>
221
222
  <SubType>Code</SubType>
222
223
  </ClInclude>
223
- <ClInclude Include="JsiApi.h">
224
- <DependentUpon>JsiApi.idl</DependentUpon>
225
- </ClInclude>
226
224
  <ClInclude Include="JsiReader.h">
227
225
  <DependentUpon>IJSValueReader.idl</DependentUpon>
228
226
  </ClInclude>
@@ -639,7 +637,7 @@
639
637
  <ItemGroup>
640
638
  <PackageReference Include="boost" Version="1.76.0.0" />
641
639
  <PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
642
- <PackageReference Include="ReactNative.Hermes.Windows" Version="$(HermesVersion)" />
640
+ <PackageReference Include="Microsoft.JavaScript.Hermes" Version="$(HermesVersion)" />
643
641
  <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
644
642
  <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
645
643
  <PackageReference Include="$(V8PackageName)" Version="$(V8Version)" Condition="'$(UseV8)' == 'true'" />
@@ -7,44 +7,12 @@
7
7
  <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
8
8
  <ClCompile Include="ABICxxModule.cpp" />
9
9
  <ClCompile Include="ABIViewManager.cpp" />
10
- <ClCompile Include="IReactDispatcher.cpp" />
11
- <ClCompile Include="IReactNotificationService.cpp" />
12
- <ClCompile Include="NativeModulesProvider.cpp" />
13
- <ClCompile Include="TurboModulesProvider.cpp" />
14
10
  <ClCompile Include="XamlLoadState.cpp" />
15
11
  <ClCompile Include="XamlView.cpp" />
16
12
  <ClCompile Include="Pch\pch.cpp">
17
13
  <Filter>Pch</Filter>
18
14
  </ClCompile>
19
- <ClCompile Include="ReactHost\AsyncActionQueue.cpp">
20
- <Filter>ReactHost</Filter>
21
- </ClCompile>
22
- <ClCompile Include="ReactHost\JSBundle.cpp">
23
- <Filter>ReactHost</Filter>
24
- </ClCompile>
25
- <ClCompile Include="ReactHost\JSBundle_Win32.cpp">
26
- <Filter>ReactHost</Filter>
27
- </ClCompile>
28
- <ClCompile Include="ReactHost\MsoUtils.cpp">
29
- <Filter>ReactHost</Filter>
30
- </ClCompile>
31
- <ClCompile Include="ReactHost\MsoReactContext.cpp">
32
- <Filter>ReactHost</Filter>
33
- </ClCompile>
34
- <ClCompile Include="ReactHost\ReactErrorProvider.cpp">
35
- <Filter>ReactHost</Filter>
36
- </ClCompile>
37
- <ClCompile Include="ReactHost\ReactHost.cpp">
38
- <Filter>ReactHost</Filter>
39
- </ClCompile>
40
- <ClCompile Include="ReactHost\ReactInstanceWin.cpp">
41
- <Filter>ReactHost</Filter>
42
- </ClCompile>
43
- <ClCompile Include="ReactHost\CrashManager.cpp">
44
- <Filter>ReactHost</Filter>
45
- </ClCompile>
46
15
  <ClCompile Include="ReactSupport.cpp" />
47
- <ClCompile Include="RedBox.cpp" />
48
16
  <ClCompile Include="TestHook.cpp" />
49
17
  <ClCompile Include="ViewManagersProvider.cpp" />
50
18
  <ClCompile Include="Base\CoreNativeModules.cpp">
@@ -143,9 +111,6 @@
143
111
  <ClCompile Include="Modules\DeviceInfoModule.cpp">
144
112
  <Filter>Modules</Filter>
145
113
  </ClCompile>
146
- <ClCompile Include="Modules\DevSettingsModule.cpp">
147
- <Filter>Modules</Filter>
148
- </ClCompile>
149
114
  <ClCompile Include="Modules\I18nManagerModule.cpp">
150
115
  <Filter>Modules</Filter>
151
116
  </ClCompile>
@@ -287,9 +252,6 @@
287
252
  <ClCompile Include="Utils\XamlIslandUtils.cpp">
288
253
  <Filter>Utils</Filter>
289
254
  </ClCompile>
290
- <ClCompile Include="JsiApi.cpp" />
291
- <ClCompile Include="RedBoxErrorInfo.cpp" />
292
- <ClCompile Include="RedBoxErrorFrameInfo.cpp" />
293
255
  <ClCompile Include="Modules\CreateModules.cpp">
294
256
  <Filter>Modules</Filter>
295
257
  </ClCompile>
@@ -302,9 +264,6 @@
302
264
  <ClCompile Include="Utils\BatchingEventEmitter.cpp">
303
265
  <Filter>Utils</Filter>
304
266
  </ClCompile>
305
- <ClCompile Include="ReactHost\JSCallInvokerScheduler.cpp">
306
- <Filter>ReactHost</Filter>
307
- </ClCompile>
308
267
  <ClCompile Include="Views\Text\TextHighlighterVisitor.cpp">
309
268
  <Filter>Views\Text</Filter>
310
269
  </ClCompile>
@@ -333,6 +292,7 @@
333
292
  <ClCompile Include="Views\FrameworkElementTransferProperties.cpp" />
334
293
  <ClCompile Include="Views\ReactViewInstance.cpp" />
335
294
  <ClCompile Include="CoreApp.cpp" />
295
+ <ClCompile Include="Utils\KeyboardUtils.cpp" />
336
296
  </ItemGroup>
337
297
  <ItemGroup>
338
298
  <ClInclude Include="ABICxxModule.h" />
@@ -735,25 +695,12 @@
735
695
  <ClInclude Include="ReactPointerEventArgs.h" />
736
696
  <ClInclude Include="Views\FrameworkElementTransferProperties.h" />
737
697
  <ClInclude Include="Views\ReactViewInstance.h" />
698
+ <ClInclude Include="Utils\KeyboardUtils.h" />
738
699
  </ItemGroup>
739
700
  <ItemGroup>
740
- <Midl Include="IJSValueReader.idl" />
741
- <Midl Include="IJSValueWriter.idl" />
742
- <Midl Include="IReactContext.idl" />
743
- <Midl Include="IReactDispatcher.idl" />
744
- <Midl Include="IReactModuleBuilder.idl" />
745
- <Midl Include="IReactNonAbiValue.idl" />
746
- <Midl Include="IReactNotificationService.idl" />
747
- <Midl Include="IReactPackageBuilder.idl" />
748
- <Midl Include="IReactPackageProvider.idl" />
749
- <Midl Include="IReactPropertyBag.idl" />
750
701
  <Midl Include="IViewManager.idl" />
751
702
  <Midl Include="ReactApplication.idl" />
752
- <Midl Include="ReactInstanceSettings.idl" />
753
- <Midl Include="ReactNativeHost.idl" />
754
703
  <Midl Include="ReactRootView.idl" />
755
- <Midl Include="RedBoxHandler.idl" />
756
- <Midl Include="QuirkSettings.idl" />
757
704
  <Midl Include="XamlHelper.idl" />
758
705
  <Midl Include="LayoutService.idl" />
759
706
  <Midl Include="XamlUIService.idl" />
@@ -770,11 +717,9 @@
770
717
  <Filter>Views\cppwinrt</Filter>
771
718
  </Midl>
772
719
  <Midl Include="IViewManagerCore.idl" />
773
- <Midl Include="JsiApi.idl" />
774
720
  <Midl Include="DocString.idl" />
775
721
  <Midl Include="DesktopWindowMessage.idl" />
776
722
  <Midl Include="ReactPointerEventArgs.idl" />
777
- <Midl Include="ReactCoreInjection.idl" />
778
723
  </ItemGroup>
779
724
  <ItemGroup>
780
725
  <None Include="microsoft.reactnative.def" />
@@ -100,6 +100,13 @@ std::string ReactSettingsSnapshot::BundleAppId() const noexcept {
100
100
  return {};
101
101
  }
102
102
 
103
+ bool ReactSettingsSnapshot::RequestDevBundle() const noexcept {
104
+ if (auto instance = m_reactInstance.GetStrongPtr()) {
105
+ return instance->RequestDevBundle();
106
+ }
107
+ return {};
108
+ }
109
+
103
110
  JSIEngine ReactSettingsSnapshot::JsiEngine() const noexcept {
104
111
  if (auto instance = m_reactInstance.GetStrongPtr()) {
105
112
  return instance->JsiEngine();
@@ -30,6 +30,7 @@ class ReactSettingsSnapshot final : public Mso::UnknownObject<IReactSettingsSnap
30
30
  bool RequestInlineSourceMap() const noexcept override;
31
31
  std::string JavaScriptBundleFile() const noexcept override;
32
32
  std::string BundleAppId() const noexcept override;
33
+ bool RequestDevBundle() const noexcept override;
33
34
  bool UseDeveloperSupport() const noexcept override;
34
35
  JSIEngine JsiEngine() const noexcept override;
35
36
 
@@ -105,6 +105,7 @@ struct IReactSettingsSnapshot : IUnknown {
105
105
  virtual bool RequestInlineSourceMap() const noexcept = 0;
106
106
  virtual std::string JavaScriptBundleFile() const noexcept = 0;
107
107
  virtual std::string BundleAppId() const noexcept = 0;
108
+ virtual bool RequestDevBundle() const noexcept = 0;
108
109
  virtual bool UseDeveloperSupport() const noexcept = 0;
109
110
  virtual JSIEngine JsiEngine() const noexcept = 0;
110
111
  };
@@ -152,6 +153,7 @@ struct ReactDevOptions {
152
153
  std::string SourceBundleName; // Bundle name without any extension (e.g. "index.win32"). Default: "index.{PLATFORM}"
153
154
  std::string SourceBundleExtension; // Bundle name extension. Default: ".bundle".
154
155
  std::string BundleAppId; // Bundle app id. Default: "".
156
+ bool DevBundle{true}; // When requesting bundle from bundle server, query for dev bundle or release bundle
155
157
 
156
158
  //! Module name used for loading the debug bundle.
157
159
  //! e.g. The modules name registered in the jsbundle via AppRegistry.registerComponent('ModuleName', () =>
@@ -73,12 +73,12 @@
73
73
  #include <Utils/UwpScriptStore.h>
74
74
  #endif
75
75
 
76
+ #include "BaseScriptStoreImpl.h"
76
77
  #include "HermesRuntimeHolder.h"
77
78
 
78
79
  #if defined(USE_V8)
79
80
  #include <winrt/Windows.Storage.h>
80
- #include "BaseScriptStoreImpl.h"
81
- #include "V8JSIRuntimeHolder.h"
81
+ #include "JSI/V8RuntimeHolder.h"
82
82
  #endif // USE_V8
83
83
 
84
84
  #include "RedBox.h"
@@ -255,7 +255,7 @@ ReactInstanceWin::ReactInstanceWin(
255
255
  onDestroyed = m_options.OnInstanceDestroyed,
256
256
  reactContext = m_reactContext]() noexcept {
257
257
  whenLoaded.TryCancel(); // It only has an effect if whenLoaded was not set before
258
- facebook::react::HermesRuntimeHolder::storeTo(ReactPropertyBag(reactContext->Properties()), nullptr);
258
+ Microsoft::ReactNative::HermesRuntimeHolder::storeTo(ReactPropertyBag(reactContext->Properties()), nullptr);
259
259
  if (onDestroyed) {
260
260
  onDestroyed.Get()->Invoke(reactContext);
261
261
  }
@@ -451,6 +451,7 @@ void ReactInstanceWin::Initialize() noexcept {
451
451
  devSettings->debuggerAttachCallback = GetDebuggerAttachCallback();
452
452
  devSettings->enableDefaultCrashHandler = m_options.EnableDefaultCrashHandler();
453
453
  devSettings->bundleAppId = BundleAppId();
454
+ devSettings->devBundle = RequestDevBundle();
454
455
  devSettings->showDevMenuCallback = [weakThis]() noexcept {
455
456
  if (auto strongThis = weakThis.GetStrongPtr()) {
456
457
  strongThis->m_uiQueue->Post(
@@ -486,9 +487,21 @@ void ReactInstanceWin::Initialize() noexcept {
486
487
 
487
488
  switch (m_options.JsiEngine()) {
488
489
  case JSIEngine::Hermes: {
489
- auto hermesRuntimeHolder =
490
- std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
491
- facebook::react::HermesRuntimeHolder::storeTo(
490
+ // TODO: Should we use UwpPreparedScriptStore?
491
+ if (Microsoft::ReactNative::HasPackageIdentity()) {
492
+ preparedScriptStore =
493
+ std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
494
+ } else {
495
+ wchar_t tempPath[MAX_PATH];
496
+ if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
497
+ preparedScriptStore =
498
+ std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
499
+ }
500
+ }
501
+
502
+ auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
503
+ devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
504
+ Microsoft::ReactNative::HermesRuntimeHolder::storeTo(
492
505
  ReactPropertyBag(m_reactContext->Properties()), hermesRuntimeHolder);
493
506
  devSettings->jsiRuntimeHolder = hermesRuntimeHolder;
494
507
  break;
@@ -512,14 +525,10 @@ void ReactInstanceWin::Initialize() noexcept {
512
525
  enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
513
526
  #endif // USE_FABRIC
514
527
 
515
- devSettings->jsiRuntimeHolder = std::make_shared<facebook::react::V8JSIRuntimeHolder>(
516
- devSettings,
517
- m_jsMessageThread.Load(),
518
- std::move(scriptStore),
519
- std::move(preparedScriptStore),
520
- enableMultiThreadSupport);
521
-
522
- } break;
528
+ devSettings->jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::V8RuntimeHolder>(
529
+ devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore), enableMultiThreadSupport);
530
+ break;
531
+ }
523
532
  #endif // USE_V8
524
533
  case JSIEngine::Chakra:
525
534
  #ifndef CORE_ABI
@@ -1103,13 +1112,10 @@ Mso::CntPtr<IReactInstanceInternal> MakeReactInstance(
1103
1112
  reactHost, std::move(options), std::move(whenCreated), std::move(whenLoaded), std::move(updateUI));
1104
1113
  }
1105
1114
 
1106
- #if defined(USE_V8)
1107
1115
  std::string ReactInstanceWin::getApplicationTempFolder() {
1108
1116
  auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
1109
-
1110
1117
  return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
1111
1118
  }
1112
- #endif
1113
1119
 
1114
1120
  bool ReactInstanceWin::UseWebDebugger() const noexcept {
1115
1121
  return m_useWebDebugger;
@@ -1166,6 +1172,10 @@ std::string ReactInstanceWin::BundleAppId() const noexcept {
1166
1172
  return m_options.DeveloperSettings.BundleAppId;
1167
1173
  }
1168
1174
 
1175
+ bool ReactInstanceWin::RequestDevBundle() const noexcept {
1176
+ return m_options.DeveloperSettings.DevBundle;
1177
+ }
1178
+
1169
1179
  bool ReactInstanceWin::UseDeveloperSupport() const noexcept {
1170
1180
  return m_options.UseDeveloperSupport();
1171
1181
  }
@@ -80,6 +80,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
80
80
  bool RequestInlineSourceMap() const noexcept;
81
81
  std::string JavaScriptBundleFile() const noexcept;
82
82
  std::string BundleAppId() const noexcept;
83
+ bool RequestDevBundle() const noexcept;
83
84
  bool UseDeveloperSupport() const noexcept;
84
85
  JSIEngine JsiEngine() const noexcept;
85
86
 
@@ -135,9 +136,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
135
136
  folly::dynamic Args;
136
137
  };
137
138
 
138
- #if defined(USE_V8)
139
139
  static std::string getApplicationTempFolder();
140
- #endif
141
140
 
142
141
  private: // immutable fields
143
142
  const Mso::WeakPtr<IReactHost> m_weakReactHost;
@@ -66,6 +66,10 @@ struct ReactInstanceSettings : ReactInstanceSettingsT<ReactInstanceSettings> {
66
66
  hstring BundleAppId() noexcept;
67
67
  void BundleAppId(hstring const &value) noexcept;
68
68
 
69
+ //! When querying the bundle server for a bundle, should it request the dev bundle or release bundle
70
+ bool RequestDevBundle() noexcept;
71
+ void RequestDevBundle(bool value) noexcept;
72
+
69
73
  //! Should the instance run in a remote environment such as within a browser
70
74
  //! By default, this is using a browser navigated to http://localhost:8081/debugger-ui served
71
75
  //! by Metro/Haul. Debugging will start as soon as the React Native instance is loaded.
@@ -174,6 +178,7 @@ struct ReactInstanceSettings : ReactInstanceSettingsT<ReactInstanceSettings> {
174
178
  single_threaded_vector<IReactPackageProvider>()};
175
179
  hstring m_javaScriptBundleFile{};
176
180
  hstring m_bundleAppId{};
181
+ bool m_devBundle{true};
177
182
  bool m_enableJITCompilation{true};
178
183
  bool m_enableByteCodeCaching{false};
179
184
  hstring m_byteCodeFileUri{};
@@ -239,6 +244,14 @@ inline void ReactInstanceSettings::BundleAppId(hstring const &value) noexcept {
239
244
  m_bundleAppId = value;
240
245
  }
241
246
 
247
+ inline bool ReactInstanceSettings::RequestDevBundle() noexcept {
248
+ return m_devBundle;
249
+ }
250
+
251
+ inline void ReactInstanceSettings::RequestDevBundle(bool value) noexcept {
252
+ m_devBundle = value;
253
+ }
254
+
242
255
  inline bool ReactInstanceSettings::EnableJITCompilation() noexcept {
243
256
  return m_enableJITCompilation;
244
257
  }
@@ -111,6 +111,10 @@ namespace Microsoft.ReactNative
111
111
  "If no value is set, the parameter will not be passed.")
112
112
  String BundleAppId { get; set; };
113
113
 
114
+ DOC_STRING(
115
+ "When querying the bundle server for a bundle, should it request the dev bundle or release bundle.")
116
+ Boolean RequestDevBundle { get; set; };
117
+
114
118
  DOC_STRING(
115
119
  "Controls whether the instance JavaScript runs in a remote environment such as within a browser.\n"
116
120
  "By default, this is using a browser navigated to http://localhost:8081/debugger-ui served by Metro/Haul.\n"
@@ -151,6 +151,7 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
151
151
  reactOptions.DeveloperSettings.SourceBundlePort = m_instanceSettings.SourceBundlePort();
152
152
  reactOptions.DeveloperSettings.RequestInlineSourceMap = m_instanceSettings.RequestInlineSourceMap();
153
153
  reactOptions.DeveloperSettings.BundleAppId = to_string(m_instanceSettings.BundleAppId());
154
+ reactOptions.DeveloperSettings.DevBundle = m_instanceSettings.RequestDevBundle();
154
155
 
155
156
  reactOptions.ByteCodeFileUri = to_string(m_instanceSettings.ByteCodeFileUri());
156
157
  reactOptions.EnableByteCodeCaching = m_instanceSettings.EnableByteCodeCaching();
@@ -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
@@ -15,6 +15,14 @@
15
15
  <TurboModule_SourcePath Condition="'$(TurboModule_SourcePath)' == '' AND Exists('$(MSBuildThisFileDirectory)ReactCommon\TurboModule.h')">$(MSBuildThisFileDirectory)</TurboModule_SourcePath>
16
16
  <Bridging_SourcePath Condition="'$(Bridging_SourcePath)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\ReactCommon\react\bridging</Bridging_SourcePath>
17
17
  <Bridging_SourcePath Condition="'$(Bridging_SourcePath)' == '' AND Exists('$(MSBuildThisFileDirectory)ReactCommon\CallbackWrapper.h')">$(MSBuildThisFileDirectory)ReactCommon</Bridging_SourcePath>
18
+
19
+ <NodeApiJsiCommitHash>53b897b03c1c7e57c3372acc6234447a44e150d6</NodeApiJsiCommitHash>
20
+ <NodeApiJsiLocal Condition="Exists('$(MSBuildThisFileDirectory)NodeApiJsiRuntime.cpp')">true</NodeApiJsiLocal>
21
+ <NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(NodeApiJsiLocal)' == 'true'">$(MSBuildThisFileDirectory)</NodeApiJsiDir>
22
+ <NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\..\..\node_modules\.node-api-jsi\node-api-jsi-$(NodeApiJsiCommitHash)\</NodeApiJsiDir>
23
+ <NodeApiJsiSrcDir Condition="'$(NodeApiJsiSrcDir)' == '' AND '$(NodeApiJsiLocal)' != 'true'">$(NodeApiJsiDir)src\</NodeApiJsiSrcDir>
24
+ <NodeApiJsiSrcDir Condition="'$(NodeApiJsiSrcDir)' == ''">$(MSBuildThisFileDirectory)</NodeApiJsiSrcDir>
25
+ <NodeApiDir Condition="'$(NodeApiDir)' == ''">$(NodeApiJsiDir)node-api\</NodeApiDir>
18
26
  </PropertyGroup>
19
27
  <ItemDefinitionGroup>
20
28
  <ClCompile>
@@ -24,6 +32,8 @@
24
32
  $(CallInvoker_SourcePath);
25
33
  $(TurboModule_SourcePath);
26
34
  $(Bridging_SourcePath);
35
+ $(NodeApiDir);
36
+ $(NodeApiJsiSrcDir);
27
37
  %(AdditionalIncludeDirectories)
28
38
  </AdditionalIncludeDirectories>
29
39
  </ClCompile>
@@ -41,7 +51,6 @@
41
51
  <ClInclude Include="$(MSBuildThisFileDirectory)CoreApp.h" />
42
52
  <ClInclude Include="$(MSBuildThisFileDirectory)DesktopWindowBridge.h" />
43
53
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\LongLivedJsiValue.h" />
44
- <ClInclude Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.h" />
45
54
  <ClInclude Include="$(MSBuildThisFileDirectory)TurboModuleProvider.h" />
46
55
  <ClInclude Include="$(CallInvoker_SourcePath)\ReactCommon\CallInvoker.h" />
47
56
  <ClInclude Include="$(CallInvoker_SourcePath)\ReactCommon\SchedulerPriority.h" />
@@ -92,6 +101,14 @@
92
101
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Media.Media3D.h" />
93
102
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Navigation.h" />
94
103
  <ClInclude Include="$(MSBuildThisFileDirectory)UI.Xaml.Shapes.h" />
104
+ <ClInclude Include="$(NodeApiDir)js_native_api.h" />
105
+ <ClInclude Include="$(NodeApiDir)js_native_api_types.h" />
106
+ <ClInclude Include="$(NodeApiDir)js_runtime_api.h" />
107
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.h" />
108
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.inc" />
109
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.h" />
110
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.inc" />
111
+ <ClInclude Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.h" />
95
112
  </ItemGroup>
96
113
  <ItemGroup Condition="'$(BuildMSRNCxx)' != 'false'">
97
114
  <ClCompile Include="$(MSBuildThisFileDirectory)JSI\JsiAbiApi.cpp" />
@@ -104,16 +121,18 @@
104
121
  <ClCompile Include="$(MSBuildThisFileDirectory)ReactPromise.cpp" />
105
122
  <ClCompile Include="$(MSBuildThisFileDirectory)TurboModuleProvider.cpp" />
106
123
  </ItemGroup>
107
- <ItemGroup Condition="'$(BuildMSRNCxx)' != 'false' and '$(BuildMSRNCxxReactCommon)' != 'false'">
108
- <!--
109
- Make sure all FB code uses the same flags to improve build parallelism.
110
- This is because msbuild has to invoke different cl.exe invocations for each
111
- set of flags and msbuild inside a project is single threaded.
112
- -->
124
+ <ItemGroup Condition="'$(BuildMSRNCxxJsi)' != 'false'">
113
125
  <ClCompile Include="$(JSI_SourcePath)\jsi\jsi.cpp">
114
126
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
115
127
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
116
128
  </ClCompile>
129
+ </ItemGroup>
130
+ <ItemGroup Condition="'$(BuildMSRNCxxReactCommon)' != 'false'">
131
+ <!--
132
+ Make sure all Meta code uses the same flags to improve build parallelism.
133
+ This is because msbuild has to invoke different cl.exe invocations for each
134
+ set of flags and msbuild inside a project is single threaded.
135
+ -->
117
136
  <ClCompile Include="$(Bridging_SourcePath)\LongLivedObject.cpp">
118
137
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
119
138
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
@@ -127,13 +146,23 @@
127
146
  <DisableSpecificWarnings>%(DisableSpecificWarnings);4100</DisableSpecificWarnings>
128
147
  </ClCompile>
129
148
  </ItemGroup>
130
- <ItemGroup>
131
- <None Include="$(MSBuildThisFileDirectory)README.md" />
149
+ <ItemGroup Condition="'$(BuildMSRNCxxNodeApiJsi)' != 'false'">
150
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.cpp">
151
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
152
+ </ClCompile>
153
+ <ClCompile Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.cpp">
154
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
155
+ </ClCompile>
156
+ <ClCompile Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.cpp">
157
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
158
+ </ClCompile>
132
159
  </ItemGroup>
133
- <ItemGroup Condition="'$(BuildMSRNCxx)' != 'false' and '$(RNExternalReferences)' != 'true'">
134
- <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.cpp">
160
+ <ItemGroup Condition="'$(BuildMSRNCxxNodeApiJsiLoader)' != 'false'">
161
+ <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiLoader.cpp">
135
162
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
136
- <ExcludedFromBuild Condition="'$(UseV8)' != 'true'">true</ExcludedFromBuild>
137
163
  </ClCompile>
138
164
  </ItemGroup>
165
+ <ItemGroup>
166
+ <None Include="$(MSBuildThisFileDirectory)README.md" />
167
+ </ItemGroup>
139
168
  </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" />
@@ -156,14 +159,19 @@
156
159
  <ClInclude Include="$(MSBuildThisFileDirectory)XamlUtils.h">
157
160
  <Filter>UI</Filter>
158
161
  </ClInclude>
159
- <ClInclude Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.h">
160
- <Filter>JSI</Filter>
161
- </ClInclude>
162
162
  <ClInclude Include="$(Bridging_SourcePath)\CallbackWrapper.h" />
163
163
  <ClInclude Include="$(MSBuildThisFileDirectory)CoreApp.h" />
164
164
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\LongLivedJsiValue.h">
165
165
  <Filter>TurboModule</Filter>
166
166
  </ClInclude>
167
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.h" />
168
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\NodeApi.inc" />
169
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.h" />
170
+ <ClInclude Include="$(NodeApiJsiSrcDir)ApiLoaders\JSRuntimeApi.inc" />
171
+ <ClInclude Include="$(NodeApiJsiSrcDir)NodeApiJsiRuntime.h" />
172
+ <ClInclude Include="$(NodeApiDir)js_native_api.h" />
173
+ <ClInclude Include="$(NodeApiDir)js_native_api_types.h" />
174
+ <ClInclude Include="$(NodeApiDir)js_runtime_api.h" />
167
175
  </ItemGroup>
168
176
  <ItemGroup>
169
177
  <Filter Include="JSI">
@@ -175,6 +183,9 @@
175
183
  <Filter Include="TurboModule">
176
184
  <UniqueIdentifier>{b5c0294c-d72f-44fa-8509-369f7d3e4a56}</UniqueIdentifier>
177
185
  </Filter>
186
+ <Filter Include="NodeApiJsi">
187
+ <UniqueIdentifier>{a34cd50a-190c-4cbb-8fe1-6ff1e16fe389}</UniqueIdentifier>
188
+ </Filter>
178
189
  </ItemGroup>
179
190
  <ItemGroup>
180
191
  <None Include="$(MSBuildThisFileDirectory)README.md" />
@@ -32,6 +32,8 @@ namespace Microsoft.ReactNative.Managed
32
32
 
33
33
  public bool UseWebDebugger => IsValid ? Handle.UseWebDebugger : false;
34
34
 
35
+ public bool RequestDevBundle => IsValid ? Handle.RequestDevBundle : true;
36
+
35
37
  public IReactSettingsSnapshot Handle { get; }
36
38
 
37
39
  public bool IsValid => Handle != null;