react-native-windows 0.66.6 → 0.66.10

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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,85 @@
2
2
  "name": "react-native-windows",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 03 Jan 2022 16:10:41 GMT",
5
+ "date": "Mon, 07 Feb 2022 16:12:16 GMT",
6
+ "tag": "react-native-windows_v0.66.10",
7
+ "version": "0.66.10",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "UI Manager module is not being destroyed on the UI thread",
12
+ "author": "30809111+acoates-ms@users.noreply.github.com",
13
+ "commit": "9e305803ba81e2375ce6a7cf894a34a23d9002e5",
14
+ "package": "react-native-windows"
15
+ },
16
+ {
17
+ "comment": "Replace __APPLE__ with __clang__ where applicable (#9461)",
18
+ "author": "julio.rocha@microsoft.com",
19
+ "commit": "95b78a0cb078c672a251929d4b56fd104a6b96b8",
20
+ "package": "react-native-windows"
21
+ },
22
+ {
23
+ "comment": "Add additional exports for react-native-win32.dll",
24
+ "author": "30809111+acoates-ms@users.noreply.github.com",
25
+ "commit": "135e512fec934a253ded4bd179171a4608e69fe8",
26
+ "package": "react-native-windows"
27
+ },
28
+ {
29
+ "comment": "Hermes inspector is not starting when Hermes engine is used (#9426)",
30
+ "author": "anandrag@microsoft.com",
31
+ "commit": "507432b5c47971f0bc4e76a608e360d56e37b105",
32
+ "package": "react-native-windows"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ {
38
+ "date": "Mon, 31 Jan 2022 16:12:38 GMT",
39
+ "tag": "react-native-windows_v0.66.9",
40
+ "version": "0.66.9",
41
+ "comments": {
42
+ "patch": [
43
+ {
44
+ "comment": "Better reporting of failures to load the bundle file",
45
+ "author": "30809111+acoates-ms@users.noreply.github.com",
46
+ "commit": "0951f3da2e746f1feb0bd7e96d3dd8d5d936d6fb",
47
+ "package": "react-native-windows"
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "date": "Mon, 24 Jan 2022 16:11:33 GMT",
54
+ "tag": "react-native-windows_v0.66.8",
55
+ "version": "0.66.8",
56
+ "comments": {
57
+ "patch": [
58
+ {
59
+ "comment": "Promote 0.66 to legacy",
60
+ "author": "ngerlem@microsoft.com",
61
+ "commit": "919d91a3e9845f9a60417fb8e47a36d7caedbc28",
62
+ "package": "react-native-windows"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ {
68
+ "date": "Mon, 17 Jan 2022 16:12:35 GMT",
69
+ "tag": "react-native-windows_v0.66.7",
70
+ "version": "0.66.7",
71
+ "comments": {
72
+ "patch": [
73
+ {
74
+ "comment": "Fork HoverState.js to allow hover events on Pressable",
75
+ "author": "saadnajmi2@gmail.com",
76
+ "commit": "1a70a3b499a0e695597e8669439b856d41096170",
77
+ "package": "react-native-windows"
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ {
83
+ "date": "Mon, 03 Jan 2022 16:10:55 GMT",
6
84
  "tag": "react-native-windows_v0.66.6",
7
85
  "version": "0.66.6",
8
86
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,52 @@
1
1
  # Change Log - react-native-windows
2
2
 
3
- This log was last generated on Mon, 03 Jan 2022 16:10:41 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 07 Feb 2022 16:12:16 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.66.6
7
+ ## 0.66.10
8
8
 
9
- Mon, 03 Jan 2022 16:10:41 GMT
9
+ Mon, 07 Feb 2022 16:12:16 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - [0.66] Avoid capturing raw this pointer in WebSocket module (julio.rocha@microsoft.com)
13
+ - UI Manager module is not being destroyed on the UI thread (30809111+acoates-ms@users.noreply.github.com)
14
+ - Replace __APPLE__ with __clang__ where applicable (#9461) (julio.rocha@microsoft.com)
15
+ - Add additional exports for react-native-win32.dll (30809111+acoates-ms@users.noreply.github.com)
16
+ - Hermes inspector is not starting when Hermes engine is used (#9426) (anandrag@microsoft.com)
14
17
 
18
+ ## 0.66.9
19
+
20
+ Mon, 31 Jan 2022 16:12:38 GMT
21
+
22
+ ### Patches
23
+
24
+ - Better reporting of failures to load the bundle file (30809111+acoates-ms@users.noreply.github.com)
25
+
26
+ ## 0.66.8
27
+
28
+ Mon, 24 Jan 2022 16:11:33 GMT
29
+
30
+ ### Patches
31
+
32
+ - Promote 0.66 to legacy (ngerlem@microsoft.com)
33
+
34
+ ## 0.66.7
35
+
36
+ Mon, 17 Jan 2022 16:12:35 GMT
37
+
38
+ ### Patches
39
+
40
+ - Fork HoverState.js to allow hover events on Pressable (saadnajmi2@gmail.com)
41
+
42
+ ## 0.66.6
43
+
44
+ Mon, 03 Jan 2022 16:10:55 GMT
45
+
46
+ ### Patches
47
+
48
+ - [0.66] Avoid capturing raw this pointer in WebSocket module (julio.rocha@microsoft.com)
49
+
15
50
  ## 0.66.5
16
51
 
17
52
  Mon, 22 Nov 2021 16:09:58 GMT
@@ -25,6 +25,7 @@ import usePressability from '../../Pressability/usePressability';
25
25
  import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect';
26
26
  import type {
27
27
  LayoutEvent,
28
+ MouseEvent,
28
29
  PressEvent,
29
30
  // [Windows
30
31
  BlurEvent,
@@ -72,6 +73,16 @@ type Props = $ReadOnly<{|
72
73
  */
73
74
  children: React.Node | ((state: StateCallbackType) => React.Node),
74
75
 
76
+ /**
77
+ * Duration to wait after hover in before calling `onHoverIn`.
78
+ */
79
+ delayHoverIn?: ?number,
80
+
81
+ /**
82
+ * Duration to wait after hover out before calling `onHoverOut`.
83
+ */
84
+ delayHoverOut?: ?number,
85
+
75
86
  /**
76
87
  * Duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
77
88
  */
@@ -98,6 +109,16 @@ type Props = $ReadOnly<{|
98
109
  */
99
110
  onLayout?: ?(event: LayoutEvent) => mixed,
100
111
 
112
+ /**
113
+ * Called when the hover is activated to provide visual feedback.
114
+ */
115
+ onHoverIn?: ?(event: MouseEvent) => mixed,
116
+
117
+ /**
118
+ * Called when the hover is deactivated to undo visual feedback.
119
+ */
120
+ onHoverOut?: ?(event: MouseEvent) => mixed,
121
+
101
122
  /**
102
123
  * Called when a long-tap gesture is detected.
103
124
  */
@@ -201,9 +222,13 @@ function Pressable(props: Props, forwardedRef): React.Node {
201
222
  android_ripple,
202
223
  cancelable,
203
224
  children,
225
+ delayHoverIn,
226
+ delayHoverOut,
204
227
  delayLongPress,
205
228
  disabled,
206
229
  focusable,
230
+ onHoverIn,
231
+ onHoverOut,
207
232
  onLongPress,
208
233
  onPress,
209
234
  onPressIn,
@@ -267,8 +292,12 @@ function Pressable(props: Props, forwardedRef): React.Node {
267
292
  hitSlop,
268
293
  pressRectOffset: pressRetentionOffset,
269
294
  android_disableSound,
295
+ delayHoverIn,
296
+ delayHoverOut,
270
297
  delayLongPress,
271
298
  delayPressIn: unstable_pressDelay,
299
+ onHoverIn,
300
+ onHoverOut,
272
301
  onLongPress,
273
302
  onPress,
274
303
  onPressIn(event: PressEvent): void {
@@ -301,9 +330,13 @@ function Pressable(props: Props, forwardedRef): React.Node {
301
330
  android_disableSound,
302
331
  android_rippleConfig,
303
332
  cancelable,
333
+ delayHoverIn,
334
+ delayHoverOut,
304
335
  delayLongPress,
305
336
  disabled,
306
337
  hitSlop,
338
+ onHoverIn,
339
+ onHoverOut,
307
340
  onLongPress,
308
341
  onPress,
309
342
  onPressIn,
@@ -49,6 +49,10 @@ if (Platform.OS === 'web') {
49
49
  document.addEventListener('touchmove', disableHover, true);
50
50
  document.addEventListener('mousemove', enableHover, true);
51
51
  }
52
+ // [Windows
53
+ } else if (Platform.OS === 'windows') {
54
+ isEnabled = true;
55
+ // Windows]
52
56
  }
53
57
 
54
58
  export function isHoverEnabled(): boolean {
@@ -395,7 +395,7 @@ facebook::jsi::JSError const &jsError) { \
395
395
  }
396
396
 
397
397
  /*static*/ ReactNative::JsiRuntime JsiRuntime::GetOrCreate(
398
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
398
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
399
399
  std::shared_ptr<facebook::jsi::Runtime> const &jsiRuntime) noexcept {
400
400
  {
401
401
  std::scoped_lock lock{s_mutex};
@@ -409,7 +409,7 @@ facebook::jsi::JSError const &jsError) { \
409
409
  }
410
410
 
411
411
  /*static*/ ReactNative::JsiRuntime JsiRuntime::Create(
412
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
412
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
413
413
  std::shared_ptr<facebook::jsi::Runtime> const &jsiRuntime) noexcept {
414
414
  // There are some functions that we cannot do using JSI such as
415
415
  // defining a property or using Symbol as a key.
@@ -445,7 +445,7 @@ ReactNative::JsiRuntime JsiRuntime::MakeChakraRuntime() {
445
445
  }
446
446
 
447
447
  JsiRuntime::JsiRuntime(
448
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> &&runtimeHolder,
448
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> &&runtimeHolder,
449
449
  std::shared_ptr<facebook::jsi::Runtime> &&runtime) noexcept
450
450
  : m_runtimeHolder{std::move(runtimeHolder)},
451
451
  m_runtime{std::move(runtime)},
@@ -58,16 +58,16 @@ struct RuntimeAccessor;
58
58
 
59
59
  struct JsiRuntime : JsiRuntimeT<JsiRuntime> {
60
60
  JsiRuntime(
61
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> &&runtimeHolder,
61
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> &&runtimeHolder,
62
62
  std::shared_ptr<facebook::jsi::Runtime> &&runtime) noexcept;
63
63
  ~JsiRuntime() noexcept;
64
64
 
65
65
  static ReactNative::JsiRuntime FromRuntime(facebook::jsi::Runtime &runtime) noexcept;
66
66
  static ReactNative::JsiRuntime GetOrCreate(
67
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
67
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
68
68
  std::shared_ptr<facebook::jsi::Runtime> const &jsiRuntime) noexcept;
69
69
  static ReactNative::JsiRuntime Create(
70
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
70
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> const &jsiRuntimeHolder,
71
71
  std::shared_ptr<facebook::jsi::Runtime> const &jsiRuntime) noexcept;
72
72
 
73
73
  public: // JsiRuntime
@@ -168,7 +168,7 @@ struct JsiRuntime : JsiRuntimeT<JsiRuntime> {
168
168
  void SetError(facebook::jsi::JSINativeException const &nativeException) noexcept;
169
169
 
170
170
  private:
171
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> m_runtimeHolder;
171
+ std::shared_ptr<::Microsoft::JSI::RuntimeHolderLazyInit> m_runtimeHolder;
172
172
  std::shared_ptr<facebook::jsi::Runtime> m_runtime;
173
173
  RuntimeAccessor *m_runtimeAccessor{};
174
174
  std::mutex m_mutex;
@@ -514,7 +514,7 @@ UIManager::UIManager() : m_module(std::make_shared<UIManagerModule>()) {}
514
514
  UIManager::~UIManager() {
515
515
  // To make sure that we destroy UI components in UI thread.
516
516
  if (!m_context.UIDispatcher().HasThreadAccess()) {
517
- m_context.UIDispatcher().Post([module = std::move(m_module)]() {});
517
+ m_context.UIDispatcher().Post([module = std::move(m_module)]() mutable { module = nullptr; });
518
518
  }
519
519
  }
520
520
 
@@ -139,14 +139,9 @@ struct ReactViewInstance : public Mso::UnknownObject<Mso::RefCountStrategy::Weak
139
139
  inline Mso::Future<void> PostInUIQueue(winrt::delegate<ReactNative::IReactViewInstance> const &action) noexcept {
140
140
  Mso::Promise<void> promise;
141
141
 
142
- // ReactViewInstance has shorter lifetime than ReactRootControl. Thus, we capture this WeakPtr.
143
- m_uiDispatcher.Post([weakThis = Mso::WeakPtr{this}, promise, action{std::move(action)}]() mutable noexcept {
144
- if (auto strongThis = weakThis.GetStrongPtr()) {
145
- action(strongThis->m_rootControl);
146
- promise.SetValue();
147
- } else {
148
- promise.TryCancel();
149
- }
142
+ m_uiDispatcher.Post([control = m_rootControl, promise, action{std::move(action)}]() mutable noexcept {
143
+ action(control);
144
+ promise.SetValue();
150
145
  });
151
146
  return promise.AsFuture();
152
147
  }
@@ -159,9 +154,7 @@ winrt::Windows::Foundation::IAsyncAction ReactViewHost::AttachViewInstance(
159
154
  }
160
155
 
161
156
  winrt::Windows::Foundation::IAsyncAction ReactViewHost::DetachViewInstance() noexcept {
162
- Mso::Promise<void> promise;
163
- promise.SetValue();
164
- return make<Mso::AsyncActionFutureAdapter>(promise.AsFuture());
157
+ return make<Mso::AsyncActionFutureAdapter>(m_viewHost->DetachViewInstance());
165
158
  }
166
159
 
167
160
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -5,9 +5,9 @@
5
5
 
6
6
  #include "React.h"
7
7
 
8
- namespace facebook::jsi {
8
+ namespace Microsoft::JSI {
9
9
  struct RuntimeHolderLazyInit;
10
- } // namespace facebook::jsi
10
+ } // namespace Microsoft::JSI
11
11
 
12
12
  namespace Mso::React {
13
13
 
@@ -379,8 +379,13 @@ Mso::Future<void> ReactHost::LoadInQueue(ReactOptions &&options) noexcept {
379
379
  }
380
380
  }
381
381
 
382
- return whenLoaded.AsFuture().Then(m_executor, [this](Mso::Maybe<void> && /*value*/) noexcept {
382
+ return whenLoaded.AsFuture().Then(m_executor, [this](Mso::Maybe<void> &&value) noexcept {
383
383
  std::vector<Mso::Future<void>> loadCompletionList;
384
+
385
+ if (value.IsError()) {
386
+ return Mso::MakeFailedFuture<void>(std::move(value.TakeError()));
387
+ }
388
+
384
389
  ForEachViewHost([&loadCompletionList](auto &viewHost) noexcept {
385
390
  loadCompletionList.push_back(viewHost.UpdateViewInstanceInQueue());
386
391
  });
@@ -224,9 +224,11 @@ ReactInstanceWin::ReactInstanceWin(
224
224
  m_whenLoaded.AsFuture()
225
225
  .Then<Mso::Executors::Inline>(
226
226
  [onLoaded = m_options.OnInstanceLoaded, reactContext = m_reactContext](Mso::Maybe<void> &&value) noexcept {
227
+ auto errCode = value.IsError() ? value.TakeError() : Mso::ErrorCode();
227
228
  if (onLoaded) {
228
- onLoaded.Get()->Invoke(reactContext, value.IsError() ? value.TakeError() : Mso::ErrorCode());
229
+ onLoaded.Get()->Invoke(reactContext, errCode);
229
230
  }
231
+ return Mso::Maybe<void>(errCode);
230
232
  })
231
233
  .Then(Queue(), [whenLoaded = std::move(whenLoaded)](Mso::Maybe<void> &&value) noexcept {
232
234
  whenLoaded.SetValue(std::move(value));
@@ -468,7 +470,7 @@ void ReactInstanceWin::Initialize() noexcept {
468
470
  m_options.TurboModuleProvider,
469
471
  std::make_unique<BridgeUIBatchInstanceCallback>(weakThis),
470
472
  m_jsMessageThread.Load(),
471
- Mso::Copy(m_batchingUIThread),
473
+ m_nativeMessageThread.Load(),
472
474
  std::move(devSettings));
473
475
 
474
476
  m_instanceWrapper.Exchange(std::move(instanceWrapper));
@@ -483,6 +485,16 @@ void ReactInstanceWin::Initialize() noexcept {
483
485
  }
484
486
  #endif
485
487
 
488
+ // The InstanceCreated event can be used to augment the JS environment for all JS code. So it needs to be
489
+ // triggered before any platform JS code is run. Using m_jsMessageThread instead of jsDispatchQueue avoids
490
+ // waiting for the JSCaller which can delay the event until after certain JS code has already run
491
+ m_jsMessageThread.Load()->runOnQueue(
492
+ [onCreated = m_options.OnInstanceCreated, reactContext = m_reactContext]() noexcept {
493
+ if (onCreated) {
494
+ onCreated.Get()->Invoke(reactContext);
495
+ }
496
+ });
497
+
486
498
  LoadJSBundles();
487
499
 
488
500
  if (UseDeveloperSupport() && State() != ReactInstanceState::HasError) {
@@ -558,7 +570,9 @@ void ReactInstanceWin::LoadJSBundles() noexcept {
558
570
 
559
571
  try {
560
572
  instanceWrapper->loadBundleSync(Mso::Copy(strongThis->JavaScriptBundleFile()));
561
- strongThis->OnReactInstanceLoaded(Mso::ErrorCode{});
573
+ if (strongThis->State() != ReactInstanceState::HasError) {
574
+ strongThis->OnReactInstanceLoaded(Mso::ErrorCode{});
575
+ }
562
576
  } catch (...) {
563
577
  strongThis->OnReactInstanceLoaded(Mso::ExceptionErrorProvider().MakeErrorCode(std::current_exception()));
564
578
  }
@@ -629,13 +643,6 @@ void ReactInstanceWin::InitJSMessageThread() noexcept {
629
643
  Mso::Copy(m_whenDestroyed));
630
644
  auto jsDispatchQueue = Mso::DispatchQueue::MakeCustomQueue(Mso::CntPtr(scheduler));
631
645
 
632
- // This work item will be processed as a first item in JS queue when the react instance is created.
633
- jsDispatchQueue.Post([onCreated = m_options.OnInstanceCreated, reactContext = m_reactContext]() noexcept {
634
- if (onCreated) {
635
- onCreated.Get()->Invoke(reactContext);
636
- }
637
- });
638
-
639
646
  auto jsDispatcher =
640
647
  winrt::make<winrt::Microsoft::ReactNative::implementation::ReactDispatcher>(Mso::Copy(jsDispatchQueue));
641
648
  m_options.Properties.Set(ReactDispatcherHelper::JSDispatcherProperty(), jsDispatcher);
@@ -886,7 +893,7 @@ void ReactInstanceWin::DispatchEvent(int64_t viewTag, std::string &&eventName, f
886
893
  }
887
894
 
888
895
  winrt::Microsoft::ReactNative::JsiRuntime ReactInstanceWin::JsiRuntime() noexcept {
889
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> jsiRuntimeHolder;
896
+ std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> jsiRuntimeHolder;
890
897
  {
891
898
  std::scoped_lock lock{m_mutex};
892
899
  if (m_jsiRuntime) {
@@ -184,7 +184,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
184
184
  Mso::CntPtr<Mso::React::IDispatchQueue2> m_uiQueue;
185
185
  std::deque<JSCallEntry> m_jsCallQueue;
186
186
 
187
- std::shared_ptr<facebook::jsi::RuntimeHolderLazyInit> m_jsiRuntimeHolder;
187
+ std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> m_jsiRuntimeHolder;
188
188
  winrt::Microsoft::ReactNative::JsiRuntime m_jsiRuntime{nullptr};
189
189
  };
190
190
 
@@ -280,7 +280,7 @@ constexpr void ValidateCoroutineArg() noexcept {
280
280
  static_assert(
281
281
  !std::is_reference_v<TArg> && !std::is_pointer_v<TArg>,
282
282
  "Coroutine parameter must be passed by value for safe access"
283
- #ifndef __APPLE__
283
+ #ifndef __clang__
284
284
  ": " __FUNCSIG__
285
285
  #endif
286
286
  );
@@ -27,18 +27,20 @@ struct AsyncActionFutureAdapter : winrt::implements<
27
27
  if (strongThis->m_status == AsyncStatus::Started) {
28
28
  if (result.IsValue()) {
29
29
  strongThis->m_status = AsyncStatus::Completed;
30
- if (strongThis->m_completedAssigned) {
31
- handler = std::move(strongThis->m_completed);
32
- }
33
30
  } else {
34
- strongThis->m_status = AsyncStatus::Error;
35
31
  strongThis->m_error = result.GetError();
32
+ strongThis->m_status = Mso::CancellationErrorProvider().TryGetErrorInfo(strongThis->m_error, false)
33
+ ? AsyncStatus::Canceled
34
+ : AsyncStatus::Error;
35
+ }
36
+ if (strongThis->m_completedAssigned) {
37
+ handler = std::move(strongThis->m_completed);
36
38
  }
37
39
  }
38
40
  }
39
41
 
40
42
  if (handler) {
41
- invoke(handler, *strongThis, AsyncStatus::Completed);
43
+ invoke(handler, *strongThis, strongThis->m_status);
42
44
  }
43
45
  }
44
46
  });
@@ -9,6 +9,10 @@
9
9
 
10
10
  namespace Microsoft::JSI {
11
11
 
12
+ facebook::react::JSIEngineOverride ChakraRuntimeHolder::getRuntimeType() noexcept {
13
+ return facebook::react::JSIEngineOverride::Chakra;
14
+ }
15
+
12
16
  std::shared_ptr<facebook::jsi::Runtime> ChakraRuntimeHolder::getRuntime() noexcept {
13
17
  std::call_once(once_flag_, [this]() { initRuntime(); });
14
18
 
@@ -12,9 +12,10 @@
12
12
 
13
13
  namespace Microsoft::JSI {
14
14
 
15
- class ChakraRuntimeHolder final : public facebook::jsi::RuntimeHolderLazyInit {
15
+ class ChakraRuntimeHolder final : public Microsoft::JSI::RuntimeHolderLazyInit {
16
16
  public:
17
17
  std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept override;
18
+ facebook::react::JSIEngineOverride getRuntimeType() noexcept override;
18
19
 
19
20
  ChakraRuntimeHolder(
20
21
  std::shared_ptr<facebook::react::DevSettings> devSettings,
@@ -14,11 +14,9 @@
14
14
  #define STRING_(s) #s
15
15
  #define STRING(s) STRING_(s)
16
16
 
17
- namespace facebook {
18
- namespace jsi {
17
+ namespace Microsoft::JSI {
19
18
  struct RuntimeHolderLazyInit;
20
- }
21
- } // namespace facebook
19
+ } // namespace Microsoft::JSI
22
20
 
23
21
  namespace facebook {
24
22
  namespace react {
@@ -81,7 +79,7 @@ struct DevSettings {
81
79
  /// instance. This object should in general be used only from the JS engine
82
80
  /// thread, unless the specific runtime implementation explicitly guarantees
83
81
  /// reentrancy.
84
- std::shared_ptr<jsi::RuntimeHolderLazyInit> jsiRuntimeHolder;
82
+ std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> jsiRuntimeHolder;
85
83
 
86
84
  // Until the ABI story is addressed we'll use this instead of the above for
87
85
  // the purposes of selecting a JSI Runtime to use.
@@ -72,6 +72,10 @@ class HermesExecutorRuntimeAdapter final : public facebook::hermes::inspector::R
72
72
 
73
73
  } // namespace
74
74
 
75
+ facebook::react::JSIEngineOverride HermesRuntimeHolder::getRuntimeType() noexcept {
76
+ return facebook::react::JSIEngineOverride::Hermes;
77
+ }
78
+
75
79
  std::shared_ptr<jsi::Runtime> HermesRuntimeHolder::getRuntime() noexcept {
76
80
  std::call_once(m_once_flag, [this]() { initRuntime(); });
77
81
 
@@ -12,9 +12,10 @@
12
12
  namespace facebook {
13
13
  namespace react {
14
14
 
15
- class HermesRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit {
15
+ class HermesRuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
16
16
  public:
17
17
  std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept override;
18
+ facebook::react::JSIEngineOverride getRuntimeType() noexcept override;
18
19
 
19
20
  HermesRuntimeHolder(
20
21
  std::shared_ptr<facebook::react::DevSettings> devSettings,
@@ -96,7 +96,11 @@ void NapiJsiV8RuntimeHolder::InitRuntime() noexcept {
96
96
  m_ownThreadId = std::this_thread::get_id();
97
97
  }
98
98
 
99
- #pragma region facebook::jsi::RuntimeHolderLazyInit
99
+ #pragma region Microsoft::JSI::RuntimeHolderLazyInit
100
+
101
+ facebook::react::JSIEngineOverride NapiJsiV8RuntimeHolder::getRuntimeType() noexcept {
102
+ return facebook::react::JSIEngineOverride::V8NodeApi;
103
+ }
100
104
 
101
105
  shared_ptr<Runtime> NapiJsiV8RuntimeHolder::getRuntime() noexcept /*override*/
102
106
  {
@@ -112,6 +116,6 @@ shared_ptr<Runtime> NapiJsiV8RuntimeHolder::getRuntime() noexcept /*override*/
112
116
  return m_runtime;
113
117
  }
114
118
 
115
- #pragma endregion facebook::jsi::RuntimeHolderLazyInit
119
+ #pragma endregion Microsoft::JSI::RuntimeHolderLazyInit
116
120
 
117
121
  } // namespace Microsoft::JSI
@@ -10,9 +10,10 @@
10
10
 
11
11
  namespace Microsoft::JSI {
12
12
 
13
- class NapiJsiV8RuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit {
13
+ class NapiJsiV8RuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
14
14
  public:
15
15
  std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept override;
16
+ facebook::react::JSIEngineOverride getRuntimeType() noexcept override;
16
17
 
17
18
  NapiJsiV8RuntimeHolder(
18
19
  std::shared_ptr<facebook::react::DevSettings> devSettings,
@@ -3,8 +3,9 @@
3
3
  #include <jsi/jsi.h>
4
4
  #include <memory>
5
5
 
6
- namespace facebook {
7
- namespace jsi {
6
+ #include <DevSettings.h>
7
+
8
+ namespace Microsoft::JSI {
8
9
 
9
10
  // An instance of this interface is expected to
10
11
  // a. lazily create a JSI Runtime on the first call to getRuntime
@@ -15,7 +16,7 @@ namespace jsi {
15
16
 
16
17
  struct RuntimeHolderLazyInit {
17
18
  virtual std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept = 0;
19
+ virtual facebook::react::JSIEngineOverride getRuntimeType() noexcept = 0;
18
20
  };
19
21
 
20
- } // namespace jsi
21
- } // namespace facebook
22
+ } // namespace Microsoft::JSI
@@ -61,86 +61,6 @@
61
61
  #include <tracing/tracing.h>
62
62
  namespace fs = std::filesystem;
63
63
 
64
- namespace {
65
-
66
- #if (defined(_MSC_VER) && !defined(WINRT))
67
-
68
- std::string GetJSBundleDirectory(
69
- const std::string &jsBundleBasePath,
70
- const std::string &jsBundleRelativePath) noexcept {
71
- // If there is a base path, use that to calculate the absolute path.
72
- if (jsBundleBasePath.length() > 0) {
73
- std::string jsBundleDirectory = jsBundleBasePath;
74
- if (jsBundleDirectory.back() != '\\')
75
- jsBundleDirectory += '\\';
76
-
77
- return jsBundleDirectory += jsBundleRelativePath;
78
- } else if (!PathIsRelativeA(jsBundleRelativePath.c_str())) {
79
- // If the given path is an absolute path, return it as-is
80
- return jsBundleRelativePath;
81
- }
82
- // Otherwise use the path of the executable file to construct the absolute
83
- // path.
84
- else {
85
- wchar_t modulePath[MAX_PATH];
86
-
87
- auto len = GetModuleFileNameW(nullptr, modulePath, _countof(modulePath));
88
-
89
- if (len == 0 || (len == _countof(modulePath) && GetLastError() == ERROR_INSUFFICIENT_BUFFER))
90
- return jsBundleRelativePath;
91
-
92
- // remove the trailing filename as we are interested in only the path
93
- auto succeeded = PathRemoveFileSpecW(modulePath);
94
- if (!succeeded)
95
- return jsBundleRelativePath;
96
-
97
- std::string jsBundlePath = Microsoft::Common::Unicode::Utf16ToUtf8(modulePath, wcslen(modulePath));
98
- if (!jsBundlePath.empty() && jsBundlePath.back() != '\\')
99
- jsBundlePath += '\\';
100
-
101
- return jsBundlePath += jsBundleRelativePath;
102
- }
103
- }
104
-
105
- std::string GetJSBundleFilePath(const std::string &jsBundleBasePath, const std::string &jsBundleRelativePath) {
106
- auto jsBundleFilePath = GetJSBundleDirectory(jsBundleBasePath, jsBundleRelativePath);
107
-
108
- // Usually, the module name: "module name" + "." + "platform name", for
109
- // example "lpc.win32". If we can not find the the bundle.js file under the
110
- // normal folder, we are trying to find it under the folder without the dot
111
- // (e.g. "lpcwin32"). VSO:1997035 remove this code after we have better name
112
- // convension
113
- if (PathFileExistsA((jsBundleFilePath + "\\bundle.js").c_str())) {
114
- jsBundleFilePath += "\\bundle.js";
115
- } else {
116
- // remove the dot only if is belongs to the bundle file name.
117
- size_t lastDotPosition = jsBundleFilePath.find_last_of('.');
118
- size_t bundleFilePosition = jsBundleFilePath.find_last_of('\\');
119
- if (lastDotPosition != std::string::npos &&
120
- (bundleFilePosition == std::string::npos || lastDotPosition > bundleFilePosition)) {
121
- jsBundleFilePath.erase(lastDotPosition, 1);
122
- }
123
-
124
- jsBundleFilePath += "\\bundle.js";
125
-
126
- // Back before we have base path plumbed through, we made win32 force a
127
- // seperate folder for each bundle by appending bundle.js Now that we have
128
- // base path, we can handle multiple SDXs with the same index name so we
129
- // should switch to using the same scheme as all the other platforms (and
130
- // the bundle server)
131
- // TODO: We should remove all the previous logic and use the same names as
132
- // the other platforms...
133
- if (!PathFileExistsA(jsBundleFilePath.c_str())) {
134
- jsBundleFilePath = GetJSBundleDirectory(jsBundleBasePath, jsBundleRelativePath) + ".bundle";
135
- }
136
- }
137
-
138
- return jsBundleFilePath;
139
- }
140
- #endif
141
-
142
- } // namespace
143
-
144
64
  using namespace facebook;
145
65
  using namespace Microsoft::JSI;
146
66
 
@@ -193,7 +113,7 @@ class OJSIExecutorFactory : public JSExecutorFactory {
193
113
  }
194
114
 
195
115
  OJSIExecutorFactory(
196
- std::shared_ptr<jsi::RuntimeHolderLazyInit> runtimeHolder,
116
+ std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> runtimeHolder,
197
117
  NativeLoggingHook loggingHook,
198
118
  std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
199
119
  bool isProfilingEnabled,
@@ -205,7 +125,7 @@ class OJSIExecutorFactory : public JSExecutorFactory {
205
125
  isProfilingEnabled_{isProfilingEnabled} {}
206
126
 
207
127
  private:
208
- std::shared_ptr<jsi::RuntimeHolderLazyInit> runtimeHolder_;
128
+ std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> runtimeHolder_;
209
129
  std::shared_ptr<TurboModuleRegistry> turboModuleRegistry_;
210
130
  std::shared_ptr<CallInvoker> jsCallInvoker_;
211
131
  NativeLoggingHook loggingHook_;
@@ -278,6 +198,20 @@ void InstanceImpl::SetInError() noexcept {
278
198
  m_isInError = true;
279
199
  }
280
200
 
201
+ namespace {
202
+ bool shouldStartHermesInspector(DevSettings &devSettings) {
203
+ bool isHermes =
204
+ ((devSettings.jsiEngineOverride == JSIEngineOverride::Hermes) ||
205
+ (devSettings.jsiEngineOverride == JSIEngineOverride::Default && devSettings.jsiRuntimeHolder &&
206
+ devSettings.jsiRuntimeHolder->getRuntimeType() == facebook::react::JSIEngineOverride::Hermes));
207
+
208
+ if (isHermes && devSettings.useDirectDebugger && !devSettings.useWebDebugger)
209
+ return true;
210
+ else
211
+ return false;
212
+ }
213
+ } // namespace
214
+
281
215
  InstanceImpl::InstanceImpl(
282
216
  std::shared_ptr<Instance> &&instance,
283
217
  std::string &&jsBundleBasePath,
@@ -305,8 +239,7 @@ InstanceImpl::InstanceImpl(
305
239
  facebook::react::tracing::initializeETW();
306
240
  #endif
307
241
 
308
- if (m_devSettings->jsiEngineOverride == JSIEngineOverride::Hermes && m_devSettings->useDirectDebugger &&
309
- !m_devSettings->useWebDebugger) {
242
+ if (shouldStartHermesInspector(*m_devSettings)) {
310
243
  m_devManager->StartInspector(m_devSettings->sourceBundleHost, m_devSettings->sourceBundlePort);
311
244
  }
312
245
 
@@ -560,22 +493,13 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
560
493
  }
561
494
  } else {
562
495
  #if (defined(_MSC_VER) && !defined(WINRT))
563
- auto fullBundleFilePath = GetJSBundleFilePath(m_jsBundleBasePath, jsBundleRelativePath);
564
-
565
- // If fullBundleFilePath exists, load User bundle.
566
- // Otherwise all bundles (User and Platform) are loaded through
567
- // platformBundles.
568
- if (PathFileExistsA(fullBundleFilePath.c_str())) {
569
- auto bundleString = FileMappingBigString::fromPath(fullBundleFilePath);
570
- m_innerInstance->loadScriptFromString(std::move(bundleString), std::move(fullBundleFilePath), synchronously);
571
- }
572
-
496
+ std::string bundlePath = (fs::path(m_devSettings->bundleRootPath) / jsBundleRelativePath).string();
497
+ auto bundleString = FileMappingBigString::fromPath(bundlePath);
573
498
  #else
574
499
  std::string bundlePath = (fs::path(m_devSettings->bundleRootPath) / (jsBundleRelativePath + ".bundle")).string();
575
-
576
500
  auto bundleString = std::make_unique<::Microsoft::ReactNative::StorageFileBigString>(bundlePath);
577
- m_innerInstance->loadScriptFromString(std::move(bundleString), jsBundleRelativePath, synchronously);
578
501
  #endif
502
+ m_innerInstance->loadScriptFromString(std::move(bundleString), std::move(jsBundleRelativePath), synchronously);
579
503
  }
580
504
  } catch (const std::exception &e) {
581
505
  m_devSettings->errorCallback(e.what());
@@ -31,6 +31,10 @@ class TaskRunnerAdapter : public v8runtime::JSITaskRunner {
31
31
  std::shared_ptr<facebook::react::MessageQueueThread> jsQueue_;
32
32
  };
33
33
 
34
+ facebook::react::JSIEngineOverride V8JSIRuntimeHolder::getRuntimeType() noexcept {
35
+ return facebook::react::JSIEngineOverride::V8;
36
+ }
37
+
34
38
  std::shared_ptr<facebook::jsi::Runtime> V8JSIRuntimeHolder::getRuntime() noexcept {
35
39
  std::call_once(once_flag_, [this]() { initRuntime(); });
36
40
 
@@ -13,9 +13,10 @@
13
13
  namespace facebook {
14
14
  namespace react {
15
15
 
16
- class V8JSIRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit {
16
+ class V8JSIRuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
17
17
  public:
18
18
  std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept override;
19
+ facebook::react::JSIEngineOverride getRuntimeType() noexcept override;
19
20
 
20
21
  V8JSIRuntimeHolder(
21
22
  std::shared_ptr<facebook::react::DevSettings> devSettings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.66.6",
3
+ "version": "0.66.10",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "@react-native-community/cli": "^6.0.0",
27
27
  "@react-native-community/cli-platform-android": "^6.0.0",
28
28
  "@react-native-community/cli-platform-ios": "^6.0.0",
29
- "@react-native-windows/cli": "0.66.1",
30
- "@react-native-windows/virtualized-list": "0.66.0",
29
+ "@react-native-windows/cli": "0.66.2",
30
+ "@react-native-windows/virtualized-list": "0.66.1",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "1.0.0",
33
33
  "@react-native/polyfills": "2.0.0",
@@ -58,7 +58,7 @@
58
58
  "ws": "^6.1.4"
59
59
  },
60
60
  "devDependencies": {
61
- "@react-native-windows/codegen": "0.66.0",
61
+ "@react-native-windows/codegen": "0.66.1",
62
62
  "@rnw-scripts/eslint-config": "1.1.7",
63
63
  "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.1",
64
64
  "@rnx-kit/jest-preset": "^0.1.0",
@@ -84,7 +84,7 @@
84
84
  "react-native": "^0.66.0"
85
85
  },
86
86
  "beachball": {
87
- "defaultNpmTag": "latest",
87
+ "defaultNpmTag": "v0.66-stable",
88
88
  "gitTags": true,
89
89
  "disallowedChangeTypes": [
90
90
  "major",