react-native-windows 0.64.22 → 0.64.26

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.
@@ -82,9 +82,6 @@
82
82
  <Optimization>Disabled</Optimization>
83
83
  </ClCompile>
84
84
  </ItemDefinitionGroup>
85
- <ItemGroup>
86
- <ClCompile Include="$(MSBuildThisFileDirectory)ChakraJsiRuntime_core.cpp" />
87
- </ItemGroup>
88
85
  <ItemGroup>
89
86
  <None Include="packages.config" />
90
87
  </ItemGroup>
@@ -11,9 +11,4 @@
11
11
  <UniqueIdentifier>{ade98a5d-cda0-4794-a7e9-9b60b83966f8}</UniqueIdentifier>
12
12
  </Filter>
13
13
  </ItemGroup>
14
- <ItemGroup>
15
- <ClCompile Include="$(MSBuildThisFileDirectory)ChakraJsiRuntime_core.cpp">
16
- <Filter>Source Files</Filter>
17
- </ClCompile>
18
- </ItemGroup>
19
14
  </Project>
@@ -144,17 +144,9 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
144
144
  JsPropertyIdRef propertyId{JS_INVALID_REFERENCE};
145
145
  // We use a #ifdef here because we can avoid a UTF-8 to UTF-16 conversion
146
146
  // using ChakraCore's JsCreatePropertyId API.
147
- #ifdef CHAKRACORE
148
- if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
149
- std::wstring utf16 = Common::Unicode::Utf8ToUtf16(name.data(), name.length());
150
- ChakraVerifyJsErrorElseThrow(JsGetPropertyIdFromName(utf16.data(), &propertyId));
151
- } else {
152
- ChakraVerifyJsErrorElseThrow(JsCreatePropertyId(name.data(), name.length(), &propertyId));
153
- }
154
- #else
155
147
  std::wstring utf16 = Common::Unicode::Utf8ToUtf16(name.data(), name.length());
156
148
  ChakraVerifyJsErrorElseThrow(JsGetPropertyIdFromName(utf16.data(), &propertyId));
157
- #endif
149
+
158
150
  return propertyId;
159
151
  }
160
152
 
@@ -275,18 +267,7 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
275
267
  /*static*/ JsValueRef ChakraApi::PointerToString(std::string_view value) {
276
268
  ChakraVerifyElseThrow(value.data(), "Cannot convert a nullptr to a JS string.");
277
269
 
278
- // ChakraCore API helps to reduce cost of UTF-8 to UTF-16 conversion.
279
- #ifdef CHAKRACORE
280
- if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
281
- return PointerToString(Common::Unicode::Utf8ToUtf16(value));
282
- } else {
283
- JsValueRef result{JS_INVALID_REFERENCE};
284
- ChakraVerifyJsErrorElseThrow(JsCreateString(value.data(), value.length(), &result));
285
- return result;
286
- }
287
- #else
288
270
  return PointerToString(Common::Unicode::Utf8ToUtf16(value));
289
- #endif
290
271
  }
291
272
 
292
273
  /*static*/ std::wstring_view ChakraApi::StringToPointer(JsValueRef string) {
@@ -300,24 +281,7 @@ ChakraApi::JsRefHolder::~JsRefHolder() noexcept {
300
281
  ChakraVerifyElseThrow(
301
282
  GetValueType(string) == JsString, "Cannot convert a non JS string ChakraObjectRef to a std::string.");
302
283
 
303
- // We use a #ifdef here because we can avoid a UTF-8 to UTF-16 conversion
304
- // using ChakraCore's JsCopyString API.
305
- #ifdef CHAKRACORE
306
- if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
307
- return Common::Unicode::Utf16ToUtf8(StringToPointer(string));
308
- } else {
309
- size_t length{0};
310
- ChakraVerifyJsErrorElseThrow(JsCopyString(string, nullptr, 0, &length));
311
-
312
- std::string result(length, 'a');
313
- ChakraVerifyJsErrorElseThrow(JsCopyString(string, result.data(), result.length(), &length));
314
-
315
- ChakraVerifyElseThrow(length == result.length(), "Failed to convert a JS string to a std::string.");
316
- return result;
317
- }
318
- #else
319
284
  return Common::Unicode::Utf16ToUtf8(StringToPointer(string));
320
- #endif
321
285
  }
322
286
 
323
287
  /*static*/ JsValueRef ChakraApi::ConvertValueToString(JsValueRef value) {
@@ -3,14 +3,10 @@
3
3
 
4
4
  #pragma once
5
5
 
6
- #ifdef CHAKRACORE
7
- #include "ChakraCore.h"
8
- #else
9
6
  #ifndef USE_EDGEMODE_JSRT
10
7
  #define USE_EDGEMODE_JSRT
11
8
  #endif
12
9
  #include <jsrt.h>
13
- #endif
14
10
 
15
11
  #include <cassert>
16
12
  #include <cstddef>
@@ -15,7 +15,7 @@ JsStartDebugging();
15
15
 
16
16
  namespace Microsoft::JSI {
17
17
 
18
- #if defined(USE_EDGEMODE_JSRT) && !defined(CHAKRACORE)
18
+ #if defined(USE_EDGEMODE_JSRT)
19
19
  /*static*/ void ChakraRuntime::initRuntimeVersion() noexcept {}
20
20
  #endif
21
21
 
@@ -42,11 +42,7 @@ std::unique_ptr<const facebook::jsi::Buffer> SystemChakraRuntime::generatePrepar
42
42
  const std::wstring scriptUTF16 =
43
43
  Microsoft::Common::Unicode::Utf8ToUtf16(reinterpret_cast<const char *>(sourceBuffer.data()), sourceBuffer.size());
44
44
 
45
- #ifdef CHAKRACORE
46
- unsigned int bytecodeSize = 0;
47
- #else
48
45
  unsigned long bytecodeSize = 0;
49
- #endif
50
46
  if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == JsNoError) {
51
47
  std::unique_ptr<ByteArrayBuffer> bytecodeBuffer(std::make_unique<ByteArrayBuffer>(bytecodeSize));
52
48
  if (JsSerializeScript(scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == JsNoError) {
@@ -17,14 +17,10 @@
17
17
  #include <sstream>
18
18
  #include <unordered_set>
19
19
 
20
- #ifdef CHAKRACORE
21
- #include <ChakraCore.h>
22
- #else
23
20
  #ifndef USE_EDGEMODE_JSRT
24
21
  #define USE_EDGEMODE_JSRT
25
22
  #endif
26
23
  #include <jsrt.h>
27
- #endif
28
24
 
29
25
  namespace Microsoft::JSI {
30
26
 
@@ -1027,15 +1023,7 @@ std::once_flag ChakraRuntime::s_runtimeVersionInitFlag;
1027
1023
  uint64_t ChakraRuntime::s_runtimeVersion = 0;
1028
1024
 
1029
1025
  std::unique_ptr<facebook::jsi::Runtime> makeChakraRuntime(ChakraRuntimeArgs &&args) noexcept {
1030
- #ifdef CHAKRACORE
1031
- if (React::GetRuntimeOptionBool("JSI.ForceSystemChakra")) {
1032
- return MakeSystemChakraRuntime(std::move(args));
1033
- } else {
1034
- return MakeChakraCoreRuntime(std::move(args));
1035
- }
1036
- #else
1037
1026
  return MakeSystemChakraRuntime(std::move(args));
1038
- #endif // CHAKRACORE
1039
1027
  }
1040
1028
 
1041
1029
  } // namespace Microsoft::JSI
@@ -11,7 +11,5 @@ struct ChakraRuntimeArgs;
11
11
 
12
12
  std::unique_ptr<facebook::jsi::Runtime> makeChakraRuntime(ChakraRuntimeArgs &&args) noexcept;
13
13
 
14
- std::unique_ptr<facebook::jsi::Runtime> MakeChakraCoreRuntime(ChakraRuntimeArgs &&args) noexcept;
15
-
16
14
  std::unique_ptr<facebook::jsi::Runtime> MakeSystemChakraRuntime(ChakraRuntimeArgs &&args) noexcept;
17
15
  } // namespace Microsoft::JSI
@@ -123,8 +123,6 @@
123
123
  REACTWINDOWS_BUILD - building with REACTWINDOWS_API as dll exports
124
124
  OLD_CPPWINRT is a workaround to make target version to 19H1
125
125
  -->
126
- <PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'=='true'">CHAKRACORE;CHAKRACORE_UWP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
127
- <PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'!='true'">USE_EDGEMODE_JSRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
128
126
  <PreprocessorDefinitions>
129
127
  REACTWINDOWS_BUILD;
130
128
  RN_PLATFORM=windows;
@@ -9,7 +9,7 @@
9
9
  <RunAutolinkCheck Condition="'$(RunAutolinkCheck)' == ''">true</RunAutolinkCheck>
10
10
  <AutolinkCommand Condition="'$(AutolinkCommand)' == ''">npx react-native autolink-windows</AutolinkCommand>
11
11
  <AutolinkCommandWorkingDir Condition="'$(AutolinkCommandWorkingDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(ProjectDir), 'package.json'))</AutolinkCommandWorkingDir>
12
- <AutolinkCommandArgs Condition="'$(AutolinkCommandArgs)' == '' And '$(SolutionPath)' != '' And '$(ProjectPath)' != ''">--check --sln "$([MSBuild]::MakeRelative($(AutolinkCommandWorkingDir), $(SolutionPath)))" --proj "$([MSBuild]::MakeRelative($(AutolinkCommandWorkingDir), $(ProjectPath)))"</AutolinkCommandArgs>
12
+ <AutolinkCommandArgs Condition="'$(AutolinkCommandArgs)' == '' And '$(SolutionPath)' != '' And '$(SolutionPath)' != '*Undefined*' And '$(ProjectPath)' != ''">--check --sln "$([MSBuild]::MakeRelative($(AutolinkCommandWorkingDir), $(SolutionPath)))" --proj "$([MSBuild]::MakeRelative($(AutolinkCommandWorkingDir), $(ProjectPath)))"</AutolinkCommandArgs>
13
13
  <AutolinkCommandArgs Condition="'$(AutolinkCommandArgs)' == ''">--check</AutolinkCommandArgs>
14
14
  </PropertyGroup>
15
15
 
@@ -82,6 +82,7 @@
82
82
  BOOST_NO_TYPEID - Configure boost not to check typeid (not to use RTTI)
83
83
  BOOST_SYSTEM_SOURCE - Build boost::system symbols from sources (drop dependency on boost_system.lib).
84
84
  GTEST_HAS_RTTI - Let GTest know not to use RTTI
85
+ USE_EDGEMODE_JSRT When using Chakra, enforce System Chakra instead of JS9.
85
86
  WIN32_LEAN_AND_MEAN - Reduce the Windows API included surface.
86
87
  WINRT_LEAN_AND_MEAN - Disable rarely used cppwinrt templates that impact compile-time/PCH size.
87
88
  -->
@@ -93,6 +94,7 @@
93
94
  BOOST_NO_TYPEID;
94
95
  BOOST_SYSTEM_SOURCE;
95
96
  GTEST_HAS_RTTI=0;
97
+ USE_EDGEMODE_JSRT;
96
98
  WIN32_LEAN_AND_MEAN;
97
99
  %(PreprocessorDefinitions)
98
100
  </PreprocessorDefinitions>
@@ -0,0 +1,94 @@
1
+ /*
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <math.h>
11
+ #include "YGEnums.h"
12
+ #include "YGMacros.h"
13
+
14
+ #if defined(_MSC_VER) && defined(__clang__)
15
+ #define COMPILING_WITH_CLANG_ON_WINDOWS
16
+ #endif
17
+ #if defined(COMPILING_WITH_CLANG_ON_WINDOWS)
18
+ #include <limits>
19
+ constexpr float YGUndefined = std::numeric_limits<float>::quiet_NaN();
20
+ #else
21
+ YG_EXTERN_C_BEGIN
22
+
23
+ #if defined(_MSC_VER)
24
+ #define YGUndefined __builtin_nanf("0")
25
+ #else
26
+ #define YGUndefined NAN
27
+ #endif
28
+
29
+ #endif
30
+
31
+ typedef struct YGValue {
32
+ float value;
33
+ YGUnit unit;
34
+ } YGValue;
35
+
36
+ YOGA_EXPORT extern const YGValue YGValueAuto;
37
+ YOGA_EXPORT extern const YGValue YGValueUndefined;
38
+ YOGA_EXPORT extern const YGValue YGValueZero;
39
+
40
+ #if !defined(COMPILING_WITH_CLANG_ON_WINDOWS)
41
+ YG_EXTERN_C_END
42
+ #endif
43
+ #undef COMPILING_WITH_CLANG_ON_WINDOWS
44
+
45
+ #ifdef __cplusplus
46
+
47
+ inline bool operator==(const YGValue& lhs, const YGValue& rhs) {
48
+ if (lhs.unit != rhs.unit) {
49
+ return false;
50
+ }
51
+
52
+ switch (lhs.unit) {
53
+ case YGUnitUndefined:
54
+ case YGUnitAuto:
55
+ return true;
56
+ case YGUnitPoint:
57
+ case YGUnitPercent:
58
+ return lhs.value == rhs.value;
59
+ }
60
+
61
+ return false;
62
+ }
63
+
64
+ inline bool operator!=(const YGValue& lhs, const YGValue& rhs) {
65
+ return !(lhs == rhs);
66
+ }
67
+
68
+ inline YGValue operator-(const YGValue& value) {
69
+ return {-value.value, value.unit};
70
+ }
71
+
72
+ namespace facebook {
73
+ namespace yoga {
74
+ namespace literals {
75
+
76
+ inline YGValue operator"" _pt(long double value) {
77
+ return YGValue{static_cast<float>(value), YGUnitPoint};
78
+ }
79
+ inline YGValue operator"" _pt(unsigned long long value) {
80
+ return operator"" _pt(static_cast<long double>(value));
81
+ }
82
+
83
+ inline YGValue operator"" _percent(long double value) {
84
+ return YGValue{static_cast<float>(value), YGUnitPercent};
85
+ }
86
+ inline YGValue operator"" _percent(unsigned long long value) {
87
+ return operator"" _percent(static_cast<long double>(value));
88
+ }
89
+
90
+ } // namespace literals
91
+ } // namespace yoga
92
+ } // namespace facebook
93
+
94
+ #endif
@@ -60,10 +60,16 @@ std::map<std::string, folly::dynamic> PlatformConstantsModule::getConstants() {
60
60
  }
61
61
 
62
62
  /*static*/ int32_t PlatformConstantsModule::OsVersion() noexcept {
63
- for (uint16_t i = 1;; ++i) {
64
- if (!ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", i)) {
65
- return i - 1;
63
+ try {
64
+ for (uint16_t i = 1;; ++i) {
65
+ if (!ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", i)) {
66
+ return i - 1;
67
+ }
66
68
  }
69
+ } catch (winrt::hresult_error const &e) {
70
+ // ApiInformation::IsApiContractPresent did not exist before Windows 10240
71
+ // So this indicates a version of windows earlier than this.
72
+ return 0;
67
73
  }
68
74
  }
69
75
 
@@ -388,12 +388,6 @@ InstanceImpl::InstanceImpl(
388
388
  [[fallthrough]];
389
389
  #endif
390
390
  }
391
- case JSIEngineOverride::Chakra:
392
- // Applies only to ChakraCore-linked binaries.
393
- Microsoft::React::SetRuntimeOptionBool("JSI.ForceSystemChakra", true);
394
- m_devSettings->jsiRuntimeHolder =
395
- std::make_shared<Microsoft::JSI::ChakraRuntimeHolder>(m_devSettings, m_jsThread, nullptr, nullptr);
396
- break;
397
391
  case JSIEngineOverride::V8NodeApi: {
398
392
  #if defined(USE_V8)
399
393
  std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore;
@@ -421,6 +415,7 @@ InstanceImpl::InstanceImpl(
421
415
  [[fallthrough]];
422
416
  #endif
423
417
  }
418
+ case JSIEngineOverride::Chakra:
424
419
  case JSIEngineOverride::ChakraCore:
425
420
  default: // TODO: Add other engines once supported
426
421
  m_devSettings->jsiRuntimeHolder =
@@ -564,11 +559,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
564
559
  // Otherwise all bundles (User and Platform) are loaded through
565
560
  // platformBundles.
566
561
  if (PathFileExistsA(fullBundleFilePath.c_str())) {
567
- #if defined(_CHAKRACORE_H_)
568
562
  auto bundleString = FileMappingBigString::fromPath(fullBundleFilePath);
569
- #else
570
- auto bundleString = JSBigFileString::fromPath(fullBundleFilePath);
571
- #endif
572
563
  m_innerInstance->loadScriptFromString(std::move(bundleString), std::move(fullBundleFilePath), synchronously);
573
564
  }
574
565
 
@@ -580,11 +571,7 @@ void InstanceImpl::loadBundleInternal(std::string &&jsBundleRelativePath, bool s
580
571
  m_innerInstance->loadScriptFromString(std::move(bundleString), jsBundleRelativePath, synchronously);
581
572
  #endif
582
573
  }
583
- #if defined(_CHAKRACORE_H_)
584
- } catch (const facebook::react::ChakraJSException &e) {
585
- m_devSettings->errorCallback(std::string{e.what()} + "\r\n" + e.getStack());
586
- #endif
587
- } catch (std::exception &e) {
574
+ } catch (const std::exception &e) {
588
575
  m_devSettings->errorCallback(e.what());
589
576
  }
590
577
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.64.22",
3
+ "version": "0.64.26",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,147 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- #pragma once
4
-
5
- #include <exception>
6
- #include <stdexcept>
7
-
8
- #include <ChakraDebugProtocolHandler.h>
9
- #include <ChakraDebugService.h>
10
-
11
- class DebugProtocolHandler {
12
- private:
13
- JsDebugProtocolHandler m_protocolHandler{nullptr};
14
-
15
- public:
16
- DebugProtocolHandler(JsRuntimeHandle runtime) {
17
- JsDebugProtocolHandler protocolHandler;
18
-
19
- JsErrorCode result = JsDebugProtocolHandlerCreate(runtime, &protocolHandler);
20
-
21
- if (result != JsNoError) {
22
- throw new std::runtime_error("Unable to create debug protocol handler.");
23
- }
24
-
25
- m_protocolHandler = protocolHandler;
26
- }
27
-
28
- ~DebugProtocolHandler() {
29
- Destroy();
30
- }
31
-
32
- JsErrorCode Connect(bool breakOnNextLine, JsDebugProtocolHandlerSendResponseCallback callback, void *callbackState) {
33
- JsErrorCode result = JsDebugProtocolHandlerConnect(m_protocolHandler, breakOnNextLine, callback, callbackState);
34
-
35
- return result;
36
- }
37
-
38
- JsErrorCode Destroy() {
39
- JsErrorCode result = JsNoError;
40
-
41
- if (m_protocolHandler != nullptr) {
42
- result = JsDebugProtocolHandlerDestroy(m_protocolHandler);
43
-
44
- if (result == JsNoError) {
45
- m_protocolHandler = nullptr;
46
- }
47
- }
48
-
49
- return result;
50
- }
51
-
52
- JsErrorCode Disconnect() {
53
- JsErrorCode result = JsDebugProtocolHandlerDisconnect(m_protocolHandler);
54
-
55
- return result;
56
- }
57
-
58
- JsDebugProtocolHandler GetHandle() {
59
- return m_protocolHandler;
60
- }
61
-
62
- JsErrorCode ProcessCommandQueue() {
63
- JsErrorCode result = JsDebugProtocolHandlerProcessCommandQueue(m_protocolHandler);
64
-
65
- return result;
66
- }
67
-
68
- JsErrorCode SetCommandQueueCallback(JsDebugProtocolHandlerCommandQueueCallback callback, void *callbackState) {
69
- JsErrorCode result = JsDebugProtocolHandlerSetCommandQueueCallback(m_protocolHandler, callback, callbackState);
70
-
71
- return result;
72
- }
73
-
74
- JsErrorCode WaitForDebugger() {
75
- JsErrorCode result = JsDebugProtocolHandlerWaitForDebugger(m_protocolHandler);
76
-
77
- return result;
78
- }
79
-
80
- JsErrorCode GetConsoleObject(JsValueRef *consoleObject) {
81
- JsErrorCode result = JsDebugProtocolHandlerCreateConsoleObject(m_protocolHandler, consoleObject);
82
-
83
- return result;
84
- }
85
- };
86
-
87
- class DebugService {
88
- private:
89
- JsDebugService m_service{nullptr};
90
-
91
- public:
92
- DebugService(JsRuntimeHandle runtime) {
93
- JsDebugService service;
94
-
95
- JsErrorCode result = JsDebugServiceCreate(&service);
96
-
97
- if (result != JsNoError) {
98
- throw new std::exception("Unable to create debug service.");
99
- }
100
-
101
- m_service = service;
102
- }
103
-
104
- ~DebugService() {
105
- Destroy();
106
- }
107
-
108
- JsErrorCode Close() {
109
- JsErrorCode result = JsDebugServiceClose(m_service);
110
-
111
- return result;
112
- }
113
-
114
- JsErrorCode Destroy() {
115
- JsErrorCode result = JsNoError;
116
-
117
- if (m_service != nullptr) {
118
- result = JsDebugServiceDestroy(m_service);
119
-
120
- if (result == JsNoError) {
121
- m_service = nullptr;
122
- }
123
- }
124
-
125
- return result;
126
- }
127
-
128
- JsErrorCode Listen(uint16_t port) {
129
- JsErrorCode result = JsDebugServiceListen(m_service, port);
130
-
131
- return result;
132
- }
133
-
134
- JsErrorCode
135
- RegisterHandler(std::string const &runtimeName, DebugProtocolHandler &protocolHandler, bool breakOnNextLine) {
136
- JsErrorCode result =
137
- JsDebugServiceRegisterHandler(m_service, runtimeName.c_str(), protocolHandler.GetHandle(), breakOnNextLine);
138
-
139
- return result;
140
- }
141
-
142
- JsErrorCode UnregisterHandler(std::string const &runtimeName) {
143
- JsErrorCode result = JsDebugServiceUnregisterHandler(m_service, runtimeName.c_str());
144
-
145
- return result;
146
- }
147
- };