react-native-windows 0.78.5 → 0.78.6

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 (189) hide show
  1. package/Directory.Build.props +6 -4
  2. package/Folly/Folly.vcxproj +46 -6
  3. package/Folly/Folly.vcxproj.filters +16 -4
  4. package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +26 -18
  5. package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +1205 -0
  6. package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +155 -0
  7. package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +633 -0
  8. package/Folly/TEMP_UntilFollyUpdate/{dynamic-inl.h → json/dynamic-inl.h} +3 -4
  9. package/Folly/TEMP_UntilFollyUpdate/{json.cpp → json/json.cpp} +14 -10
  10. package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +7 -14
  11. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +6 -6
  12. package/Folly/ThreadNameStub.cpp +10 -0
  13. package/Folly/cgmanifest.json +11 -1
  14. package/Libraries/Components/View/View.windows.js +107 -56
  15. package/Libraries/Components/View/ViewAccessibility.d.ts +60 -1
  16. package/Libraries/Image/Image.windows.js +42 -21
  17. package/Libraries/Modal/Modal.d.ts +7 -0
  18. package/Libraries/Modal/Modal.windows.js +7 -1
  19. package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
  20. package/Libraries/Text/Text.d.ts +18 -0
  21. package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +4 -25
  22. package/Microsoft.ReactNative/AsynchronousEventBeat.h +0 -3
  23. package/Microsoft.ReactNative/Base/FollyIncludes.h +1 -0
  24. package/Microsoft.ReactNative/CallInvoker.cpp +42 -0
  25. package/Microsoft.ReactNative/CallInvoker.h +34 -0
  26. package/Microsoft.ReactNative/{JSDispatcherWriter.cpp → CallInvokerWriter.cpp} +35 -47
  27. package/Microsoft.ReactNative/CallInvokerWriter.h +74 -0
  28. package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
  29. package/Microsoft.ReactNative/CompositionSwitcher.idl +7 -0
  30. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
  31. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -1
  32. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +12 -2
  33. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +2 -0
  34. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +100 -0
  35. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +31 -0
  36. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +77 -11
  37. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -1
  38. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +7 -0
  39. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +86 -56
  40. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -1
  41. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
  42. package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +0 -2
  43. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +118 -63
  44. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
  45. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -8
  46. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +16 -2
  47. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
  48. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
  49. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +34 -11
  50. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
  51. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +133 -135
  52. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
  53. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +46 -49
  54. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
  55. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +13 -8
  56. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
  57. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +146 -25
  58. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +14 -0
  59. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +160 -12
  60. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
  61. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +47 -0
  62. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +15 -1
  63. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
  64. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
  65. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +7 -9
  66. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -1
  67. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +5 -0
  68. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +40 -36
  69. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +68 -0
  70. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +11 -0
  71. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +70 -13
  72. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
  73. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +5 -5
  74. package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
  75. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +47 -8
  76. package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +10 -1
  77. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/CompositionAccessibilityProps.h +67 -0
  78. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +22 -4
  79. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +15 -2
  80. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -0
  81. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +5 -0
  82. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/MouseEvent.h +20 -0
  83. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
  84. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
  85. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +247 -45
  86. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +15 -0
  87. package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.cpp +39 -0
  88. package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.h +54 -0
  89. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +126 -0
  90. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +73 -0
  91. package/Microsoft.ReactNative/IReactContext.cpp +17 -0
  92. package/Microsoft.ReactNative/IReactContext.h +1 -0
  93. package/Microsoft.ReactNative/IReactContext.idl +18 -1
  94. package/Microsoft.ReactNative/IReactDispatcher.idl +1 -0
  95. package/Microsoft.ReactNative/IReactModuleBuilder.cpp +12 -0
  96. package/Microsoft.ReactNative/IReactModuleBuilder.h +2 -0
  97. package/Microsoft.ReactNative/IReactModuleBuilder.idl +8 -0
  98. package/Microsoft.ReactNative/JsiApi.cpp +10 -2
  99. package/Microsoft.ReactNative/JsiApi.h +1 -0
  100. package/Microsoft.ReactNative/JsiApi.idl +1 -0
  101. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -3
  102. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +2 -3
  103. package/Microsoft.ReactNative/Modules/AlertModule.cpp +7 -12
  104. package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
  105. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.cpp +4 -8
  106. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -2
  107. package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +6 -8
  108. package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
  109. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +6 -15
  110. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +13 -24
  111. package/Microsoft.ReactNative/QuirkSettings.cpp +0 -16
  112. package/Microsoft.ReactNative/QuirkSettings.h +0 -3
  113. package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +11 -1
  114. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +78 -68
  115. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -2
  116. package/Microsoft.ReactNative/ReactInstanceSettings.cpp +12 -0
  117. package/Microsoft.ReactNative/ReactInstanceSettings.h +2 -0
  118. package/Microsoft.ReactNative/ReactInstanceSettings.idl +6 -0
  119. package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
  120. package/Microsoft.ReactNative/ReactSupport.cpp +44 -11
  121. package/Microsoft.ReactNative/RedBox.cpp +30 -1
  122. package/Microsoft.ReactNative/SchedulerSettings.cpp +4 -4
  123. package/Microsoft.ReactNative/SchedulerSettings.h +1 -1
  124. package/Microsoft.ReactNative/TurboModulesProvider.cpp +30 -12
  125. package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
  126. package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +37 -31
  127. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +1 -0
  128. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +2 -0
  129. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +1 -1
  130. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +94 -27
  131. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +27 -6
  132. package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +45 -11
  133. package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +6 -0
  134. package/Microsoft.ReactNative.Cxx/JSI/decorator.h +220 -0
  135. package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +28 -0
  136. package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +6 -0
  137. package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +241 -4
  138. package/Microsoft.ReactNative.Cxx/JSI/jsi.h +207 -19
  139. package/Microsoft.ReactNative.Cxx/JSValue.cpp +19 -3
  140. package/Microsoft.ReactNative.Cxx/JSValue.h +15 -7
  141. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
  142. package/Microsoft.ReactNative.Cxx/NativeModules.h +60 -2
  143. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +1267 -614
  144. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +4 -2
  145. package/Microsoft.ReactNative.Cxx/ReactContext.h +7 -0
  146. package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +11 -13
  147. package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +2 -3
  148. package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +81 -20
  149. package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +47 -2
  150. package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +13 -0
  151. package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +1 -1
  152. package/Microsoft.ReactNative.Managed/ReactContext.cs +3 -1
  153. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  154. package/PropertySheets/JSEngine.props +1 -1
  155. package/PropertySheets/React.Cpp.props +2 -1
  156. package/PropertySheets/WebView2.props +1 -1
  157. package/PropertySheets/WinUI.props +2 -2
  158. package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +429 -0
  159. package/ReactCommon/cgmanifest.json +1 -1
  160. package/Shared/HermesRuntimeHolder.cpp +6 -0
  161. package/Shared/JSI/ChakraRuntime.cpp +4 -0
  162. package/Shared/JSI/ChakraRuntime.h +2 -0
  163. package/Shared/Modules/BlobModule.cpp +14 -16
  164. package/Shared/Modules/BlobModule.h +3 -1
  165. package/Shared/Shared.vcxitems +11 -7
  166. package/Shared/Shared.vcxitems.filters +6 -1
  167. package/Shared/TurboModuleManager.cpp +0 -15
  168. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +6 -6
  169. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +6 -6
  170. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +6 -6
  171. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +6 -6
  172. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +6 -6
  173. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +6 -6
  174. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +6 -6
  175. package/codegen/react/components/rnwcore/InputAccessory.g.h +6 -6
  176. package/codegen/react/components/rnwcore/ModalHostView.g.h +11 -7
  177. package/codegen/react/components/rnwcore/Props.cpp +2 -1
  178. package/codegen/react/components/rnwcore/Props.h +1 -0
  179. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +6 -6
  180. package/codegen/react/components/rnwcore/SafeAreaView.g.h +6 -6
  181. package/codegen/react/components/rnwcore/Switch.g.h +6 -6
  182. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +6 -6
  183. package/index.windows.js +4 -2
  184. package/package.json +3 -4
  185. package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
  186. package/stubs/glog/logging.h +1 -1
  187. package/Microsoft.ReactNative/JSDispatcherWriter.h +0 -47
  188. package/Microsoft.ReactNative/SynchronousEventBeat.cpp +0 -51
  189. package/Microsoft.ReactNative/SynchronousEventBeat.h +0 -31
@@ -12,8 +12,10 @@
12
12
 
13
13
  namespace Microsoft::NodeApiJsi {
14
14
 
15
- std::unique_ptr<facebook::jsi::Runtime>
16
- makeNodeApiJsiRuntime(napi_env env, JSRuntimeApi *jsrApi, std::function<void()> onDelete) noexcept;
15
+ std::unique_ptr<facebook::jsi::Runtime> makeNodeApiJsiRuntime(
16
+ napi_env env,
17
+ JSRuntimeApi *jsrApi,
18
+ std::function<void()> onDelete) noexcept;
17
19
 
18
20
  struct NodeApiEnvScope {
19
21
  NodeApiEnvScope(napi_env env) : env_(env) {
@@ -11,6 +11,7 @@
11
11
  #if !defined(CORE_ABI) && !defined(__APPLE__)
12
12
  #include <CppWinRTIncludes.h>
13
13
  #endif
14
+ #include <ReactCommon/CallInvoker.h>
14
15
  #include <string_view>
15
16
  #include "JSValueWriter.h"
16
17
  #include "ReactNotificationService.h"
@@ -18,6 +19,8 @@
18
19
 
19
20
  namespace winrt::Microsoft::ReactNative {
20
21
 
22
+ std::shared_ptr<facebook::react::CallInvoker> MakeAbiCallInvoker(IReactContext const &context) noexcept;
23
+
21
24
  // Represents a context of execution for the Native Module.
22
25
  // It wraps up the IReactContext and adds convenience methods for
23
26
  // working with C++ types.
@@ -50,6 +53,10 @@ struct ReactContext {
50
53
  return ReactDispatcher{m_handle.JSDispatcher()};
51
54
  }
52
55
 
56
+ std::shared_ptr<facebook::react::CallInvoker> CallInvoker() const noexcept {
57
+ return MakeAbiCallInvoker(m_handle);
58
+ }
59
+
53
60
  // Call methodName JS function of module with moduleName.
54
61
  // args are either function arguments or a single lambda with 'IJSValueWriter const&' argument.
55
62
  template <class... TArgs>
@@ -4,28 +4,26 @@
4
4
  #include "pch.h"
5
5
  #include "TurboModuleProvider.h"
6
6
 
7
+ #include "JSI/JsiApiContext.h"
8
+
7
9
  namespace winrt::Microsoft::ReactNative {
8
10
 
9
11
  // CallInvoker implementation based on JSDispatcher.
10
12
  struct AbiCallInvoker final : facebook::react::CallInvoker {
11
13
  AbiCallInvoker(IReactContext const &context) : m_context(context) {}
12
14
 
13
- void invokeAsync(std::function<void()> &&func) noexcept override {
14
- m_context.JSDispatcher().Post([func = std::move(func)]() { func(); });
15
- }
16
-
17
15
  void invokeAsync(facebook::react::CallFunc &&func) noexcept override {
18
- // If async is allowed to run sync if already on the JS thread, this could be replaced with just the ExecuteJsi call
19
- m_context.JSDispatcher().Post([context = m_context, func = std::move(func)]() {
20
- winrt::Microsoft::ReactNative::ExecuteJsi(context, std::move(func));
21
- });
16
+ m_context.CallInvoker().InvokeAsync(
17
+ [context = m_context, func = std::move(func)](const winrt::Windows::Foundation::IInspectable &runtimeHandle) {
18
+ func(GetOrCreateContextRuntime(context, runtimeHandle));
19
+ });
22
20
  }
23
21
 
24
- virtual void invokeSync(facebook::react::CallFunc &&func) override {
25
- // Throwing an exception in this method matches the behavior of
26
- // Instance::JSCallInvoker::invokeSync in react-native\ReactCommon\cxxreact\Instance.cpp
27
- UNREFERENCED_PARAMETER(func);
28
- throw std::runtime_error("Synchronous native -> JS calls are currently not supported.");
22
+ void invokeSync(facebook::react::CallFunc &&func) override {
23
+ m_context.CallInvoker().InvokeSync(
24
+ [context = m_context, func = std::move(func)](const winrt::Windows::Foundation::IInspectable &runtimeHandle) {
25
+ func(GetOrCreateContextRuntime(context, runtimeHandle));
26
+ });
29
27
  }
30
28
 
31
29
  private:
@@ -22,10 +22,9 @@ void AddTurboModuleProvider(IReactPackageBuilder const &packageBuilder, std::wst
22
22
  IJsiHostObject abiTurboModule{nullptr};
23
23
  // We expect the initializer to be called immediately for TurboModules
24
24
  moduleBuilder.AddInitializer([&abiTurboModule](IReactContext const &context) mutable {
25
- TryGetOrCreateContextRuntime(ReactContext{context}); // Ensure the JSI runtime is created.
26
- auto callInvoker = MakeAbiCallInvoker(context);
25
+ auto callInvoker = ReactContext{context}.CallInvoker();
27
26
  auto turboModule = std::make_shared<TTurboModule>(callInvoker);
28
- abiTurboModule = winrt::make<JsiHostObjectWrapper>(std::move(turboModule));
27
+ abiTurboModule = winrt::make<JsiHostObjectGetOrCreateWrapper>(context, std::move(turboModule));
29
28
  });
30
29
  return abiTurboModule.as<winrt::Windows::Foundation::IInspectable>();
31
30
  });
@@ -8,14 +8,18 @@
8
8
  // Use INT_MAX, this should only be consumed by the pre-processor anyway.
9
9
  #define NAPI_VERSION_EXPERIMENTAL 2147483647
10
10
  #ifndef NAPI_VERSION
11
+ #ifdef NAPI_EXPERIMENTAL
12
+ #define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
13
+ #else
11
14
  // The baseline version for N-API.
12
15
  // The NAPI_VERSION controls which version will be used by default when
13
- // compilling a native addon. If the addon developer specifically wants to use
16
+ // compiling a native addon. If the addon developer specifically wants to use
14
17
  // functions available in a new version of N-API that is not yet ported in all
15
18
  // LTS versions, they can set NAPI_VERSION knowing that they have specifically
16
19
  // depended on that version.
17
20
  #define NAPI_VERSION 8
18
21
  #endif
22
+ #endif
19
23
 
20
24
  #include "js_native_api_types.h"
21
25
 
@@ -24,7 +28,7 @@
24
28
  #ifndef NAPI_EXTERN
25
29
  #ifdef _WIN32
26
30
  #define NAPI_EXTERN __declspec(dllexport)
27
- #elif defined(__wasm32__)
31
+ #elif defined(__wasm__)
28
32
  #define NAPI_EXTERN \
29
33
  __attribute__((visibility("default"))) \
30
34
  __attribute__((__import_module__("napi")))
@@ -45,8 +49,8 @@
45
49
 
46
50
  EXTERN_C_START
47
51
 
48
- NAPI_EXTERN napi_status NAPI_CDECL
49
- napi_get_last_error_info(napi_env env, const napi_extended_error_info** result);
52
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_last_error_info(
53
+ node_api_nogc_env env, const napi_extended_error_info** result);
50
54
 
51
55
  // Getters for defined singletons
52
56
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_undefined(napi_env env,
@@ -88,9 +92,42 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
88
92
  const char16_t* str,
89
93
  size_t length,
90
94
  napi_value* result);
95
+ #ifdef NAPI_EXPERIMENTAL
96
+ #define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS
97
+ NAPI_EXTERN napi_status NAPI_CDECL
98
+ node_api_create_external_string_latin1(napi_env env,
99
+ char* str,
100
+ size_t length,
101
+ node_api_nogc_finalize finalize_callback,
102
+ void* finalize_hint,
103
+ napi_value* result,
104
+ bool* copied);
105
+ NAPI_EXTERN napi_status NAPI_CDECL
106
+ node_api_create_external_string_utf16(napi_env env,
107
+ char16_t* str,
108
+ size_t length,
109
+ node_api_nogc_finalize finalize_callback,
110
+ void* finalize_hint,
111
+ napi_value* result,
112
+ bool* copied);
113
+ #endif // NAPI_EXPERIMENTAL
114
+
115
+ #ifdef NAPI_EXPERIMENTAL
116
+ #define NODE_API_EXPERIMENTAL_HAS_PROPERTY_KEYS
117
+ NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf16(
118
+ napi_env env, const char16_t* str, size_t length, napi_value* result);
119
+ #endif // NAPI_EXPERIMENTAL
120
+
91
121
  NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env,
92
122
  napi_value description,
93
123
  napi_value* result);
124
+ #if NAPI_VERSION >= 9
125
+ NAPI_EXTERN napi_status NAPI_CDECL
126
+ node_api_symbol_for(napi_env env,
127
+ const char* utf8description,
128
+ size_t length,
129
+ napi_value* result);
130
+ #endif // NAPI_VERSION >= 9
94
131
  NAPI_EXTERN napi_status NAPI_CDECL napi_create_function(napi_env env,
95
132
  const char* utf8name,
96
133
  size_t length,
@@ -109,6 +146,10 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_range_error(napi_env env,
109
146
  napi_value code,
110
147
  napi_value msg,
111
148
  napi_value* result);
149
+ #if NAPI_VERSION >= 9
150
+ NAPI_EXTERN napi_status NAPI_CDECL node_api_create_syntax_error(
151
+ napi_env env, napi_value code, napi_value msg, napi_value* result);
152
+ #endif // NAPI_VERSION >= 9
112
153
 
113
154
  // Methods to get the native napi_value from Primitive type
114
155
  NAPI_EXTERN napi_status NAPI_CDECL napi_typeof(napi_env env,
@@ -256,7 +297,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_instanceof(napi_env env,
256
297
 
257
298
  // Gets all callback info in a single call. (Ugly, but faster.)
258
299
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_cb_info(
259
- napi_env env, // [in] NAPI environment handle
300
+ napi_env env, // [in] Node-API environment handle
260
301
  napi_callback_info cbinfo, // [in] Opaque callback-info handle
261
302
  size_t* argc, // [in-out] Specifies the size of the provided argv array
262
303
  // and receives the actual count of args.
@@ -280,7 +321,7 @@ napi_define_class(napi_env env,
280
321
  NAPI_EXTERN napi_status NAPI_CDECL napi_wrap(napi_env env,
281
322
  napi_value js_object,
282
323
  void* native_object,
283
- napi_finalize finalize_cb,
324
+ node_api_nogc_finalize finalize_cb,
284
325
  void* finalize_hint,
285
326
  napi_ref* result);
286
327
  NAPI_EXTERN napi_status NAPI_CDECL napi_unwrap(napi_env env,
@@ -292,7 +333,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_remove_wrap(napi_env env,
292
333
  NAPI_EXTERN napi_status NAPI_CDECL
293
334
  napi_create_external(napi_env env,
294
335
  void* data,
295
- napi_finalize finalize_cb,
336
+ node_api_nogc_finalize finalize_cb,
296
337
  void* finalize_hint,
297
338
  napi_value* result);
298
339
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_external(napi_env env,
@@ -363,6 +404,11 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_throw_type_error(napi_env env,
363
404
  NAPI_EXTERN napi_status NAPI_CDECL napi_throw_range_error(napi_env env,
364
405
  const char* code,
365
406
  const char* msg);
407
+ #if NAPI_VERSION >= 9
408
+ NAPI_EXTERN napi_status NAPI_CDECL node_api_throw_syntax_error(napi_env env,
409
+ const char* code,
410
+ const char* msg);
411
+ #endif // NAPI_VERSION >= 9
366
412
  NAPI_EXTERN napi_status NAPI_CDECL napi_is_error(napi_env env,
367
413
  napi_value value,
368
414
  bool* result);
@@ -386,7 +432,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
386
432
  napi_create_external_arraybuffer(napi_env env,
387
433
  void* external_data,
388
434
  size_t byte_length,
389
- napi_finalize finalize_cb,
435
+ node_api_nogc_finalize finalize_cb,
390
436
  void* finalize_hint,
391
437
  napi_value* result);
392
438
  #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
@@ -428,7 +474,7 @@ napi_get_dataview_info(napi_env env,
428
474
  size_t* byte_offset);
429
475
 
430
476
  // version management
431
- NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(napi_env env,
477
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(node_api_nogc_env env,
432
478
  uint32_t* result);
433
479
 
434
480
  // Promises
@@ -452,7 +498,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_run_script(napi_env env,
452
498
 
453
499
  // Memory management
454
500
  NAPI_EXTERN napi_status NAPI_CDECL napi_adjust_external_memory(
455
- napi_env env, int64_t change_in_bytes, int64_t* adjusted_value);
501
+ node_api_nogc_env env, int64_t change_in_bytes, int64_t* adjusted_value);
456
502
 
457
503
  #if NAPI_VERSION >= 5
458
504
 
@@ -470,15 +516,27 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_get_date_value(napi_env env,
470
516
  double* result);
471
517
 
472
518
  // Add finalizer for pointer
473
- NAPI_EXTERN napi_status NAPI_CDECL napi_add_finalizer(napi_env env,
474
- napi_value js_object,
475
- void* finalize_data,
476
- napi_finalize finalize_cb,
477
- void* finalize_hint,
478
- napi_ref* result);
519
+ NAPI_EXTERN napi_status NAPI_CDECL
520
+ napi_add_finalizer(napi_env env,
521
+ napi_value js_object,
522
+ void* finalize_data,
523
+ node_api_nogc_finalize finalize_cb,
524
+ void* finalize_hint,
525
+ napi_ref* result);
479
526
 
480
527
  #endif // NAPI_VERSION >= 5
481
528
 
529
+ #ifdef NAPI_EXPERIMENTAL
530
+ #define NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
531
+
532
+ NAPI_EXTERN napi_status NAPI_CDECL
533
+ node_api_post_finalizer(node_api_nogc_env env,
534
+ napi_finalize finalize_cb,
535
+ void* finalize_data,
536
+ void* finalize_hint);
537
+
538
+ #endif // NAPI_EXPERIMENTAL
539
+
482
540
  #if NAPI_VERSION >= 6
483
541
 
484
542
  // BigInt
@@ -516,10 +574,13 @@ napi_get_all_property_names(napi_env env,
516
574
  napi_value* result);
517
575
 
518
576
  // Instance data
519
- NAPI_EXTERN napi_status NAPI_CDECL napi_set_instance_data(
520
- napi_env env, void* data, napi_finalize finalize_cb, void* finalize_hint);
577
+ NAPI_EXTERN napi_status NAPI_CDECL
578
+ napi_set_instance_data(node_api_nogc_env env,
579
+ void* data,
580
+ napi_finalize finalize_cb,
581
+ void* finalize_hint);
521
582
 
522
- NAPI_EXTERN napi_status NAPI_CDECL napi_get_instance_data(napi_env env,
583
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_instance_data(node_api_nogc_env env,
523
584
  void** data);
524
585
  #endif // NAPI_VERSION >= 6
525
586
 
@@ -550,4 +611,4 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_object_seal(napi_env env,
550
611
 
551
612
  EXTERN_C_END
552
613
 
553
- #endif // SRC_JS_NATIVE_API_H_
614
+ #endif // SRC_JS_NATIVE_API_H_
@@ -7,6 +7,11 @@
7
7
  #include <stddef.h> // NOLINT(modernize-deprecated-headers)
8
8
  #include <stdint.h> // NOLINT(modernize-deprecated-headers)
9
9
 
10
+ // TODO: (vmoroz) NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT is not part of this
11
+ // Node-API file. It is here temporary to enable compilation. Remove it after
12
+ // updating tests.
13
+ #define NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT
14
+
10
15
  #if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)
11
16
  typedef uint16_t char16_t;
12
17
  #endif
@@ -22,6 +27,35 @@ typedef uint16_t char16_t;
22
27
  // JSVM API types are all opaque pointers for ABI stability
23
28
  // typedef undefined structs instead of void* for compile time type safety
24
29
  typedef struct napi_env__* napi_env;
30
+
31
+ // We need to mark APIs which can be called during garbage collection (GC),
32
+ // meaning that they do not affect the state of the JS engine, and can
33
+ // therefore be called synchronously from a finalizer that itself runs
34
+ // synchronously during GC. Such APIs can receive either a `napi_env` or a
35
+ // `node_api_nogc_env` as their first parameter, because we should be able to
36
+ // also call them during normal, non-garbage-collecting operations, whereas
37
+ // APIs that affect the state of the JS engine can only receive a `napi_env` as
38
+ // their first parameter, because we must not call them during GC. In lieu of
39
+ // inheritance, we use the properties of the const qualifier to accomplish
40
+ // this, because both a const and a non-const value can be passed to an API
41
+ // expecting a const value, but only a non-const value can be passed to an API
42
+ // expecting a non-const value.
43
+ //
44
+ // In conjunction with appropriate CFLAGS to warn us if we're passing a const
45
+ // (nogc) environment into an API that expects a non-const environment, and the
46
+ // definition of nogc finalizer function pointer types below, which receive a
47
+ // nogc environment as their first parameter, and can thus only call nogc APIs
48
+ // (unless the user explicitly casts the environment), we achieve the ability
49
+ // to ensure at compile time that we do not call APIs that affect the state of
50
+ // the JS engine from a synchronous (nogc) finalizer.
51
+ #if !defined(NAPI_EXPERIMENTAL) || \
52
+ (defined(NAPI_EXPERIMENTAL) && \
53
+ defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT))
54
+ typedef struct napi_env__* node_api_nogc_env;
55
+ #else
56
+ typedef const struct napi_env__* node_api_nogc_env;
57
+ #endif
58
+
25
59
  typedef struct napi_value__* napi_value;
26
60
  typedef struct napi_ref__* napi_ref;
27
61
  typedef struct napi_handle_scope__* napi_handle_scope;
@@ -99,7 +133,8 @@ typedef enum {
99
133
  napi_arraybuffer_expected,
100
134
  napi_detachable_arraybuffer_expected,
101
135
  napi_would_deadlock, // unused
102
- napi_no_external_buffers_allowed
136
+ napi_no_external_buffers_allowed,
137
+ napi_cannot_run_js,
103
138
  } napi_status;
104
139
  // Note: when adding a new enum value to `napi_status`, please also update
105
140
  // * `const int last_status` in the definition of `napi_get_last_error_info()'
@@ -115,6 +150,16 @@ typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
115
150
  void* finalize_data,
116
151
  void* finalize_hint);
117
152
 
153
+ #if !defined(NAPI_EXPERIMENTAL) || \
154
+ (defined(NAPI_EXPERIMENTAL) && \
155
+ defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT))
156
+ typedef napi_finalize node_api_nogc_finalize;
157
+ #else
158
+ typedef void(NAPI_CDECL* node_api_nogc_finalize)(node_api_nogc_env env,
159
+ void* finalize_data,
160
+ void* finalize_hint);
161
+ #endif
162
+
118
163
  typedef struct {
119
164
  // One of utf8name or name should be NULL.
120
165
  const char* utf8name;
@@ -164,4 +209,4 @@ typedef struct {
164
209
  } napi_type_tag;
165
210
  #endif // NAPI_VERSION >= 8
166
211
 
167
- #endif // SRC_JS_NATIVE_API_TYPES_H_
212
+ #endif // SRC_JS_NATIVE_API_TYPES_H_
@@ -49,6 +49,8 @@ JSR_API jsr_config_set_inspector_break_on_start(jsr_config config, bool value);
49
49
 
50
50
  JSR_API jsr_config_enable_gc_api(jsr_config config, bool value);
51
51
 
52
+ JSR_API jsr_config_set_explicit_microtasks(jsr_config config, bool value);
53
+
52
54
  //=============================================================================
53
55
  // jsr_config task runner
54
56
  //=============================================================================
@@ -127,6 +129,9 @@ JSR_API jsr_close_napi_env_scope(napi_env env, jsr_napi_env_scope scope);
127
129
  // To implement JSI description()
128
130
  JSR_API jsr_get_description(napi_env env, const char** result);
129
131
 
132
+ // To implement JSI queueMicrotask()
133
+ JSR_API jsr_queue_microtask(napi_env env, napi_value callback);
134
+
130
135
  // To implement JSI drainMicrotasks()
131
136
  JSR_API
132
137
  jsr_drain_microtasks(napi_env env, int32_t max_count_hint, bool* result);
@@ -181,6 +186,14 @@ JSR_API jsr_has_unhandled_promise_rejection(napi_env env, bool* result);
181
186
  JSR_API jsr_get_and_clear_last_unhandled_promise_rejection(napi_env env,
182
187
  napi_value* result);
183
188
 
189
+ // Create new napi_env for the runtime.
190
+ JSR_API jsr_create_node_api_env(napi_env root_env,
191
+ int32_t api_version,
192
+ napi_env* env);
193
+
194
+ // Run task in the environment context.
195
+ JSR_API jsr_run_task(napi_env env, jsr_task_run_cb task_cb, void* data);
196
+
184
197
  EXTERN_C_END
185
198
 
186
199
  #endif // !SRC_JS_RUNTIME_API_H_
@@ -72,7 +72,7 @@ inline std::ostream &GetNullLog() noexcept {
72
72
  #define LOG_EVERY_N(severity, n) GlogStub::GetNullLog()
73
73
 
74
74
  typedef int LogSeverity;
75
- inline void FlushLogFiles(LogSeverity min_severity) {}
75
+ inline void FlushLogFiles(LogSeverity) {}
76
76
 
77
77
  #define google GlogStub
78
78
  static const int GLOG_INFO = 1;
@@ -24,8 +24,10 @@ namespace Microsoft.ReactNative.Managed
24
24
 
25
25
  public ReactDispatcher UIDispatcher => new ReactDispatcher(Handle.UIDispatcher);
26
26
 
27
+ #pragma warning disable 612, 618 // Deprecated
27
28
  public ReactDispatcher JSDispatcher => new ReactDispatcher(Handle.JSDispatcher);
28
-
29
+ #pragma warning restore 612, 618
30
+
29
31
  public LoadingState LoadingState => Handle.LoadingState;
30
32
 
31
33
  public ReactSettingsSnapshot SettingsSnapshot => new ReactSettingsSnapshot(Handle.SettingsSnapshot);
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.78.5</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.78.6</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>78</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>5</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>6</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>70356efc9bee07541301328d98c4a78b7f89637f</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>e74aaadf4cf0b3c12e7561e8ea3349fa9d6998a4</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -6,7 +6,7 @@
6
6
  <!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
7
7
  <UseHermes Condition="'$(UseHermes)' == ''">true</UseHermes>
8
8
  <!-- 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 -->
9
- <HermesVersion Condition="'$(HermesVersion)' == ''">0.1.23</HermesVersion>
9
+ <HermesVersion Condition="'$(HermesVersion)' == ''">0.0.0-2505.2001-0e4bc3b9</HermesVersion>
10
10
  <HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgMicrosoft_JavaScript_Hermes)')">$(PkgMicrosoft_JavaScript_Hermes)</HermesPackage>
11
11
  <HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\Microsoft.JavaScript.Hermes\$(HermesVersion)</HermesPackage>
12
12
  <EnableHermesInspectorInReleaseFlavor Condition="'$(EnableHermesInspectorInReleaseFlavor)' == ''">false</EnableHermesInspectorInReleaseFlavor>
@@ -65,7 +65,7 @@
65
65
  <PreprocessorDefinitions Condition="'$(EnableDevServerHBCBundles)'=='true'">ENABLE_DEVSERVER_HBCBUNDLES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
66
66
  <PreprocessorDefinitions Condition="'$(UseV8)'=='true'">USE_V8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
67
67
  <PreprocessorDefinitions Condition="'$(UseFabric)'=='true'">USE_FABRIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
68
- <PreprocessorDefinitions>JSI_VERSION=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
68
+ <PreprocessorDefinitions>JSI_VERSION=19;%(PreprocessorDefinitions)</PreprocessorDefinitions>
69
69
  <!--
70
70
  To address the crash on the first call to std::mutex::lock.
71
71
  See: https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710
@@ -151,6 +151,7 @@
151
151
  $(ReactNativeDir)\ReactCommon\react\bridging;
152
152
  $(ReactNativeDir)\ReactCommon\reactperflogger;
153
153
  $(ReactNativeDir)\ReactCommon\runtimeexecutor;
154
+ $(ReactNativeDir)\ReactCxxPlatform;
154
155
  %(AdditionalIncludeDirectories);
155
156
  </AdditionalIncludeDirectories>
156
157
  </ClCompile>
@@ -3,6 +3,6 @@
3
3
  <PropertyGroup Label="WebView2 versioning">
4
4
  <!-- WinAppSDK 1.6+ has a dependency on Microsoft.Web.WebView2, there are a few places we need to pull in this package explicitly. -->
5
5
  <!-- This minimum fallback version should be greater than or equal to what's needed by both the default and experimental versions of WinAppSDK in WinUI.props. -->
6
- <WebView2PackageVersion Condition="'$(WebView2PackageVersion)'=='' Or $([MSBuild]::VersionLessThan('$(WebView2PackageVersion)', '1.0.2792.45'))">1.0.2792.45</WebView2PackageVersion>
6
+ <WebView2PackageVersion Condition="'$(WebView2PackageVersion)'=='' Or $([MSBuild]::VersionLessThan('$(WebView2PackageVersion)', '1.0.2903.40'))">1.0.2903.40</WebView2PackageVersion>
7
7
  </PropertyGroup>
8
8
  </Project>
@@ -7,10 +7,10 @@
7
7
  For local testing of internal versions, modify WinUI3ExperimentalVersion, and comment out the additional nuget source in NuGet.Config
8
8
  When this version is updated, be sure to update the default for the enableInternalFeed parameter of /.ado/templates/enable-experimental-winui3.yml and the minimum version of WebView in WebView2.props
9
9
  -->
10
- <WinUI3ExperimentalVersion Condition="'$(WinUI3ExperimentalVersion)'==''">1.7.250109001-experimental2</WinUI3ExperimentalVersion>
10
+ <WinUI3ExperimentalVersion Condition="'$(WinUI3ExperimentalVersion)'==''">1.7.250127003-experimental3</WinUI3ExperimentalVersion>
11
11
  <!-- This value is also used by the CLI, see /packages/@react-native-windows/cli/.../autolinkWindows.ts -->
12
12
  <WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">$(WinUI3ExperimentalVersion)</WinUI3Version>
13
- <WinUI3Version Condition="'$(WinUI3Version)'==''">1.6.240923002</WinUI3Version>
13
+ <WinUI3Version Condition="'$(WinUI3Version)'==''">1.7.250401001</WinUI3Version>
14
14
  <!-- This is needed to prevent build errors with WinAppSDK >= 1.7 trying to double build WindowsAppRuntimeAutoInitializer.cpp -->
15
15
  <WindowsAppSdkAutoInitialize Condition="'$(WindowsAppSdkAutoInitialize)'=='' And $([MSBuild]::VersionGreaterThan('$(WinUI3Version)', '1.7.0'))">false</WindowsAppSdkAutoInitialize>
16
16
  </PropertyGroup>