react-native-windows 0.63.36 → 0.63.40
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 +82 -1
- package/CHANGELOG.md +37 -4
- package/DeforkingPatches/ReactCommon/yoga/yoga/YGValue.h +94 -0
- package/JSI/Desktop/JSI.Desktop.vcxproj +9 -2
- package/JSI/Desktop/packages.config +1 -0
- package/JSI/Shared/JSI.Shared.vcxitems +4 -0
- package/JSI/Shared/JSI.Shared.vcxitems.filters +6 -0
- package/JSI/Shared/NapiJsiV8RuntimeHolder.cpp +117 -0
- package/JSI/Shared/NapiJsiV8RuntimeHolder.h +49 -0
- package/JSI/Universal/JSI.Universal.vcxproj +12 -2
- package/Microsoft.ReactNative/packages.config +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +1987 -0
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +21 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +6 -0
- package/PropertySheets/React.Cpp.props +2 -1
- package/Shared/DevSettings.h +3 -2
- package/Shared/OInstance.cpp +32 -0
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,88 @@
|
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 30 Sep 2021 23:54:02 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.63.40",
|
|
7
|
+
"version": "0.63.40",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Upgrade ReactNative.V8Jsi.Windows to 0.63.15",
|
|
12
|
+
"author": "julio.rocha@microsoft.com",
|
|
13
|
+
"commit": "9b2a25cc8da398280d4aa46d0b4b1538aa2ff6ce",
|
|
14
|
+
"package": "react-native-windows"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Upgrade to V8-JSI 0.63.16",
|
|
18
|
+
"author": "julio.rocha@microsoft.com",
|
|
19
|
+
"commit": "186f16f592b357a37aefe22a400c449becec0ace",
|
|
20
|
+
"package": "react-native-windows"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Mon, 27 Sep 2021 15:04:40 GMT",
|
|
27
|
+
"tag": "react-native-windows_v0.63.39",
|
|
28
|
+
"version": "0.63.39",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"comment": "Migrate NapiJsiRuntime from V8-JSI (#8617)",
|
|
33
|
+
"author": "julio.rocha@microsoft.com",
|
|
34
|
+
"commit": "e0efa83145c15014fb8a49630e37600231bee1ee",
|
|
35
|
+
"package": "react-native-windows"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Wed, 22 Sep 2021 21:25:30 GMT",
|
|
42
|
+
"tag": "react-native-windows_v0.63.38",
|
|
43
|
+
"version": "0.63.38",
|
|
44
|
+
"comments": {
|
|
45
|
+
"patch": [
|
|
46
|
+
{
|
|
47
|
+
"comment": "Change the definitino of YGUndefined from NAN (contra the comment in YGValue, MSVC does define NAN) to __builtin_nanf(\"0\"), which generates a quiet NaN. The problem with NAN is that corecrt_math.h defines it as:",
|
|
48
|
+
"author": "hpratt@microsoft.com",
|
|
49
|
+
"commit": "f15581dc3540b8484936fc7311506d3ac6fcb480",
|
|
50
|
+
"package": "react-native-windows"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"date": "Mon, 06 Sep 2021 15:08:15 GMT",
|
|
57
|
+
"tag": "react-native-windows_v0.63.37",
|
|
58
|
+
"version": "0.63.37",
|
|
59
|
+
"comments": {
|
|
60
|
+
"none": [
|
|
61
|
+
{
|
|
62
|
+
"comment": "Stop Tagging 0.63 Builds",
|
|
63
|
+
"author": "ngerlem@microsoft.com",
|
|
64
|
+
"commit": "42a5b19bd6aeba6dc1edf2e597511d9f819f7554",
|
|
65
|
+
"package": "react-native-windows"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"date": "Thu, 26 Aug 2021 14:12:28 GMT",
|
|
72
|
+
"tag": "react-native-windows_v0.63.37",
|
|
73
|
+
"version": "0.63.37",
|
|
74
|
+
"comments": {
|
|
75
|
+
"patch": [
|
|
76
|
+
{
|
|
77
|
+
"comment": "[0.63] Consume Node-Api V8 JSI Runtime",
|
|
78
|
+
"author": "julio.rocha@microsoft.com",
|
|
79
|
+
"commit": "096eea67495b2f8957cc263af8e46f5cc53e31ff",
|
|
80
|
+
"package": "react-native-windows"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"date": "Wed, 30 Jun 2021 23:23:14 GMT",
|
|
6
87
|
"tag": "react-native-windows_v0.63.36",
|
|
7
88
|
"version": "0.63.36",
|
|
8
89
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
# Change Log - react-native-windows
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 30 Sep 2021 23:54:02 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.63.
|
|
7
|
+
## 0.63.40
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Thu, 30 Sep 2021 23:54:02 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- Upgrade ReactNative.V8Jsi.Windows to 0.63.15 (julio.rocha@microsoft.com)
|
|
14
|
+
- Upgrade to V8-JSI 0.63.16 (julio.rocha@microsoft.com)
|
|
14
15
|
|
|
16
|
+
## 0.63.39
|
|
17
|
+
|
|
18
|
+
Mon, 27 Sep 2021 15:04:40 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Migrate NapiJsiRuntime from V8-JSI (#8617) (julio.rocha@microsoft.com)
|
|
23
|
+
|
|
24
|
+
## 0.63.38
|
|
25
|
+
|
|
26
|
+
Wed, 22 Sep 2021 21:25:30 GMT
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- Change the definitino of YGUndefined from NAN (contra the comment in YGValue, MSVC does define NAN) to __builtin_nanf("0"), which generates a quiet NaN. The problem with NAN is that corecrt_math.h defines it as: (hpratt@microsoft.com)
|
|
31
|
+
|
|
32
|
+
## 0.63.37
|
|
33
|
+
|
|
34
|
+
Thu, 26 Aug 2021 14:12:28 GMT
|
|
35
|
+
|
|
36
|
+
### Patches
|
|
37
|
+
|
|
38
|
+
- [0.63] Consume Node-Api V8 JSI Runtime (julio.rocha@microsoft.com)
|
|
39
|
+
|
|
40
|
+
## 0.63.36
|
|
41
|
+
|
|
42
|
+
Wed, 30 Jun 2021 23:23:14 GMT
|
|
43
|
+
|
|
44
|
+
### Patches
|
|
45
|
+
|
|
46
|
+
- Use V8 by default for desktop (if enabled) (tudor.mihai@microsoft.com)
|
|
47
|
+
|
|
15
48
|
## 0.63.35
|
|
16
49
|
|
|
17
50
|
Tue, 22 Jun 2021 22:30:55 GMT
|
|
@@ -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
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
</PropertyGroup>
|
|
35
35
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
36
36
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
37
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\ReactCommunity.Cpp.props" />
|
|
37
38
|
<PropertyGroup Label="Configuration">
|
|
38
39
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
39
40
|
</PropertyGroup>
|
|
@@ -53,13 +54,17 @@
|
|
|
53
54
|
<PropertyGroup>
|
|
54
55
|
<!-- We need $(ReactNativeWindowsDir)Chakra for ChakraCoreDebugger.h.
|
|
55
56
|
We should remove it from IncludePath once we retire the ChakraExecutor stack. -->
|
|
56
|
-
<IncludePath>$(ReactNativeWindowsDir);$(ReactNativeDir)\ReactCommon;$(ReactNativeDir)ReactCommon\callinvoker;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Chakra;$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Shared;$(IncludePath)</IncludePath>
|
|
57
|
+
<IncludePath>$(ReactNativeWindowsDir);$(FollyDir);$(ReactNativeWindowsDir)stubs;$(ReactNativeDir)\ReactCommon;$(ReactNativeDir)ReactCommon\callinvoker;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Chakra;$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)Microsoft.ReactNative.Cxx;$(IncludePath)</IncludePath>
|
|
58
|
+
<!--
|
|
59
|
+
C4459 - declaration hides global declaration
|
|
60
|
+
-->
|
|
61
|
+
<ExtraWarningsToDisable>$(ExtraWarningsToDisable);4459</ExtraWarningsToDisable>
|
|
57
62
|
</PropertyGroup>
|
|
58
63
|
<ItemDefinitionGroup>
|
|
59
64
|
<ClCompile>
|
|
60
65
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
61
66
|
<PreprocessorDefinitions Condition="'$(CHAKRACOREUWP)'=='true'">CHAKRACORE_UWP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
62
|
-
<PreprocessorDefinitions>CHAKRACORE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
67
|
+
<PreprocessorDefinitions>CHAKRACORE;FOLLY_NO_CONFIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
63
68
|
<!-- /Zc:strictStrings enforces the standard C++ const qualifications for
|
|
64
69
|
string literals. It prevents code like
|
|
65
70
|
wchar_t* str = L"hello";
|
|
@@ -85,6 +90,7 @@
|
|
|
85
90
|
</ItemGroup>
|
|
86
91
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
87
92
|
<ImportGroup Label="ExtensionTargets" Condition="'$(CHAKRACOREUWP)'!='true'">
|
|
93
|
+
<Import Project="$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets')" />
|
|
88
94
|
<Import Project="$(SolutionDir)packages\Microsoft.ChakraCore.vc140.1.11.20\build\native\Microsoft.ChakraCore.vc140.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.ChakraCore.vc140.1.11.20\build\native\Microsoft.ChakraCore.vc140.targets')" />
|
|
89
95
|
<Import Project="$(SolutionDir)packages\ChakraCore.Debugger.0.0.0.44\build\native\ChakraCore.Debugger.targets" Condition="Exists('$(SolutionDir)packages\ChakraCore.Debugger.0.0.0.44\build\native\ChakraCore.Debugger.targets')" />
|
|
90
96
|
<Import Project="$(V8_Package)\build\native\ReactNative.V8JSI.Windows.targets" Condition="Exists('$(V8_Package)\build\native\ReactNative.V8JSI.Windows.targets') AND '$(USE_V8)' == 'true'" />
|
|
@@ -94,6 +100,7 @@
|
|
|
94
100
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
95
101
|
</PropertyGroup>
|
|
96
102
|
<Warning Condition="'$(USE_V8)' != 'true'" Text="Building desktop project without USE_V8 (value is '$(USE_V8)')" />
|
|
103
|
+
<Error Condition="!Exists('$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets'))" />
|
|
97
104
|
<Error Condition="!Exists('$(SolutionDir)packages\Microsoft.ChakraCore.vc140.1.11.20\build\native\Microsoft.ChakraCore.vc140.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.ChakraCore.vc140.1.11.20\build\native\Microsoft.ChakraCore.vc140.targets'))" />
|
|
98
105
|
<Error Condition="!Exists('$(SolutionDir)packages\ChakraCore.Debugger.0.0.0.44\build\native\ChakraCore.Debugger.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\ChakraCore.Debugger.0.0.0.44\build\native\ChakraCore.Debugger.targets'))" />
|
|
99
106
|
<Error Condition="!Exists('$(V8_Package)\build\native\ReactNative.V8JSI.Windows.targets') AND '$(USE_V8)' == 'true'" Text="$([System.String]::Format('$(ErrorText)', '$(V8_Package)\build\native\ReactNative.V8JSI.Windows.targets'))" />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<packages>
|
|
3
|
+
<package id="boost" version="1.72.0.0" targetFramework="native" />
|
|
3
4
|
<package id="ChakraCore.Debugger" version="0.0.0.44" targetFramework="native" />
|
|
4
5
|
<package id="Microsoft.ChakraCore.vc140" version="1.11.20" targetFramework="native" developmentDependency="true" />
|
|
5
6
|
<package id="ReactWindows.ChakraCore.ARM64" version="1.11.20" targetFramework="native" developmentDependency="true" />
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraJsiRuntime_edgemode.cpp" />
|
|
18
18
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraObjectRef.cpp" />
|
|
19
19
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraRuntime.cpp" />
|
|
20
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)NapiJsiV8RuntimeHolder.cpp">
|
|
21
|
+
<ExcludedFromBuild Condition="'$(USE_V8)' != 'true'">true</ExcludedFromBuild>
|
|
22
|
+
</ClCompile>
|
|
20
23
|
</ItemGroup>
|
|
21
24
|
<ItemGroup>
|
|
22
25
|
<ClInclude Include="$(MSBuildThisFileDirectory)ByteArrayBuffer.h" />
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraRuntimeArgs.h" />
|
|
25
28
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraRuntimeFactory.h" />
|
|
26
29
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraRuntime.h" />
|
|
30
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)NapiJsiV8RuntimeHolder.h" />
|
|
27
31
|
<ClInclude Include="$(MSBuildThisFileDirectory)RuntimeHolder.h" />
|
|
28
32
|
<ClInclude Include="$(MSBuildThisFileDirectory)ScriptStore.h" />
|
|
29
33
|
</ItemGroup>
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
<ClInclude Include="$(MSBuildThisFileDirectory)ChakraRuntimeFactory.h">
|
|
31
31
|
<Filter>Header Files</Filter>
|
|
32
32
|
</ClInclude>
|
|
33
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)NapiJsiV8RuntimeHolder.h">
|
|
34
|
+
<Filter>Header Files</Filter>
|
|
35
|
+
</ClInclude>
|
|
33
36
|
</ItemGroup>
|
|
34
37
|
<ItemGroup>
|
|
35
38
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraObjectRef.cpp">
|
|
@@ -41,5 +44,8 @@
|
|
|
41
44
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraJsiRuntime_edgemode.cpp">
|
|
42
45
|
<Filter>Source Files</Filter>
|
|
43
46
|
</ClCompile>
|
|
47
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)NapiJsiV8RuntimeHolder.cpp">
|
|
48
|
+
<Filter>Source Files</Filter>
|
|
49
|
+
</ClCompile>
|
|
44
50
|
</ItemGroup>
|
|
45
51
|
</Project>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "NapiJsiV8RuntimeHolder.h"
|
|
5
|
+
|
|
6
|
+
using namespace facebook::jsi;
|
|
7
|
+
using namespace facebook::react;
|
|
8
|
+
|
|
9
|
+
using std::shared_ptr;
|
|
10
|
+
using std::unique_ptr;
|
|
11
|
+
|
|
12
|
+
namespace Microsoft::JSI {
|
|
13
|
+
|
|
14
|
+
struct NapiTask {
|
|
15
|
+
NapiTask(
|
|
16
|
+
napi_env env,
|
|
17
|
+
napi_ext_task_callback taskCallback,
|
|
18
|
+
void *taskData,
|
|
19
|
+
napi_finalize finalizeCallback,
|
|
20
|
+
void *finalizeHint) noexcept
|
|
21
|
+
: m_env{env},
|
|
22
|
+
m_taskCallback{taskCallback},
|
|
23
|
+
m_taskData{taskData},
|
|
24
|
+
m_finalizeCallback{finalizeCallback},
|
|
25
|
+
m_finalizeHint{finalizeHint} {}
|
|
26
|
+
|
|
27
|
+
NapiTask(const NapiTask &) = delete;
|
|
28
|
+
NapiTask &operator=(const NapiTask &) = delete;
|
|
29
|
+
|
|
30
|
+
~NapiTask() {
|
|
31
|
+
if (m_finalizeCallback) {
|
|
32
|
+
m_finalizeCallback(m_env, m_taskData, m_finalizeHint);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void operator()() noexcept {
|
|
37
|
+
m_taskCallback(m_env, m_taskData);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private:
|
|
41
|
+
napi_env m_env;
|
|
42
|
+
napi_ext_task_callback m_taskCallback;
|
|
43
|
+
void *m_taskData;
|
|
44
|
+
napi_finalize m_finalizeCallback;
|
|
45
|
+
void *m_finalizeHint;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// See napi_ext_schedule_task_callback definition.
|
|
49
|
+
/*static*/ void NapiJsiV8RuntimeHolder::ScheduleTaskCallback(
|
|
50
|
+
napi_env env,
|
|
51
|
+
napi_ext_task_callback taskCallback,
|
|
52
|
+
void *taskData,
|
|
53
|
+
uint32_t /*delayInMsec*/,
|
|
54
|
+
napi_finalize finalizeCallback,
|
|
55
|
+
void *finalizeHint) {
|
|
56
|
+
NapiJsiV8RuntimeHolder *holder;
|
|
57
|
+
auto result = napi_get_instance_data(env, (void **)&holder);
|
|
58
|
+
if (result != napi_status::napi_ok) {
|
|
59
|
+
std::terminate();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
auto task = std::make_shared<NapiTask>(env, taskCallback, taskData, finalizeCallback, finalizeHint);
|
|
63
|
+
holder->m_jsQueue->runOnQueue([task = std::move(task)]() { task->operator()(); });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
NapiJsiV8RuntimeHolder::NapiJsiV8RuntimeHolder(
|
|
67
|
+
shared_ptr<DevSettings> devSettings,
|
|
68
|
+
shared_ptr<MessageQueueThread> jsQueue,
|
|
69
|
+
unique_ptr<ScriptStore> &&scriptStore,
|
|
70
|
+
unique_ptr<PreparedScriptStore> &&preparedScriptStore) noexcept
|
|
71
|
+
: m_useDirectDebugger{devSettings->useDirectDebugger},
|
|
72
|
+
m_debuggerBreakOnNextLine{devSettings->debuggerBreakOnNextLine},
|
|
73
|
+
m_debuggerPort{devSettings->debuggerPort},
|
|
74
|
+
m_debuggerRuntimeName{devSettings->debuggerRuntimeName},
|
|
75
|
+
m_jsQueue{jsQueue},
|
|
76
|
+
m_scriptStore{std::move(scriptStore)},
|
|
77
|
+
m_preparedScriptStore{std::move(preparedScriptStore)} {}
|
|
78
|
+
|
|
79
|
+
void NapiJsiV8RuntimeHolder::InitRuntime() noexcept {
|
|
80
|
+
napi_env env{};
|
|
81
|
+
napi_ext_env_settings settings{};
|
|
82
|
+
settings.this_size = sizeof(settings);
|
|
83
|
+
settings.flags.enable_gc_api = true;
|
|
84
|
+
if (m_debuggerPort > 0)
|
|
85
|
+
settings.inspector_port = m_debuggerPort;
|
|
86
|
+
|
|
87
|
+
settings.flags.enable_inspector = m_useDirectDebugger;
|
|
88
|
+
settings.flags.wait_for_debugger = m_debuggerBreakOnNextLine;
|
|
89
|
+
settings.foreground_scheduler = &NapiJsiV8RuntimeHolder::ScheduleTaskCallback;
|
|
90
|
+
|
|
91
|
+
napi_ext_create_env(&settings, &env);
|
|
92
|
+
// Associate environment to holder.
|
|
93
|
+
napi_set_instance_data(env, this, nullptr /*finalize_cb*/, nullptr /*finalize_hint*/);
|
|
94
|
+
|
|
95
|
+
m_runtime = MakeNodeApiJsiRuntime(env);
|
|
96
|
+
m_ownThreadId = std::this_thread::get_id();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#pragma region facebook::jsi::RuntimeHolderLazyInit
|
|
100
|
+
|
|
101
|
+
shared_ptr<Runtime> NapiJsiV8RuntimeHolder::getRuntime() noexcept /*override*/
|
|
102
|
+
{
|
|
103
|
+
std::call_once(m_onceFlag, [this]() { InitRuntime(); });
|
|
104
|
+
|
|
105
|
+
if (!m_runtime)
|
|
106
|
+
std::terminate();
|
|
107
|
+
|
|
108
|
+
// V8 NapiJsiRuntime is not known to be thread safe.
|
|
109
|
+
if (m_ownThreadId != std::this_thread::get_id())
|
|
110
|
+
__fastfail(FAST_FAIL_INVALID_THREAD);
|
|
111
|
+
|
|
112
|
+
return m_runtime;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#pragma endregion facebook::jsi::RuntimeHolderLazyInit
|
|
116
|
+
|
|
117
|
+
} // namespace Microsoft::JSI
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <DevSettings.h>
|
|
7
|
+
#include <JSI/NodeApiJsiRuntime.h>
|
|
8
|
+
#include "RuntimeHolder.h"
|
|
9
|
+
#include "ScriptStore.h"
|
|
10
|
+
|
|
11
|
+
namespace Microsoft::JSI {
|
|
12
|
+
|
|
13
|
+
class NapiJsiV8RuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit {
|
|
14
|
+
public:
|
|
15
|
+
std::shared_ptr<facebook::jsi::Runtime> getRuntime() noexcept override;
|
|
16
|
+
|
|
17
|
+
NapiJsiV8RuntimeHolder(
|
|
18
|
+
std::shared_ptr<facebook::react::DevSettings> devSettings,
|
|
19
|
+
std::shared_ptr<facebook::react::MessageQueueThread> jsQueue,
|
|
20
|
+
std::unique_ptr<facebook::jsi::ScriptStore> &&scriptStore,
|
|
21
|
+
std::unique_ptr<facebook::jsi::PreparedScriptStore> &&preparedScriptStore) noexcept;
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
static void ScheduleTaskCallback(
|
|
25
|
+
napi_env env,
|
|
26
|
+
napi_ext_task_callback taskCb,
|
|
27
|
+
void *taskData,
|
|
28
|
+
uint32_t delayMs,
|
|
29
|
+
napi_finalize finalizeCb,
|
|
30
|
+
void *finalizeHint);
|
|
31
|
+
|
|
32
|
+
void InitRuntime() noexcept;
|
|
33
|
+
|
|
34
|
+
std::shared_ptr<facebook::jsi::Runtime> m_runtime;
|
|
35
|
+
std::shared_ptr<facebook::react::MessageQueueThread> m_jsQueue;
|
|
36
|
+
|
|
37
|
+
std::unique_ptr<facebook::jsi::ScriptStore> m_scriptStore;
|
|
38
|
+
std::unique_ptr<facebook::jsi::PreparedScriptStore> m_preparedScriptStore;
|
|
39
|
+
|
|
40
|
+
std::once_flag m_onceFlag;
|
|
41
|
+
std::thread::id m_ownThreadId;
|
|
42
|
+
|
|
43
|
+
uint16_t m_debuggerPort;
|
|
44
|
+
bool m_useDirectDebugger{false};
|
|
45
|
+
bool m_debuggerBreakOnNextLine{false};
|
|
46
|
+
std::string m_debuggerRuntimeName;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace Microsoft::JSI
|
|
@@ -65,14 +65,18 @@
|
|
|
65
65
|
<GenerateManifest>false</GenerateManifest>
|
|
66
66
|
</PropertyGroup>
|
|
67
67
|
<PropertyGroup>
|
|
68
|
-
<IncludePath>$(ReactNativeDir)\ReactCommon;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Shared;$(IncludePath)</IncludePath>
|
|
68
|
+
<IncludePath>$(ReactNativeDir)\ReactCommon;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)Microsoft.ReactNative.Cxx;$(IncludePath)</IncludePath>
|
|
69
|
+
<!--
|
|
70
|
+
C4459 - declaration hides global declaration
|
|
71
|
+
-->
|
|
72
|
+
<ExtraWarningsToDisable>$(ExtraWarningsToDisable);4459</ExtraWarningsToDisable>
|
|
69
73
|
</PropertyGroup>
|
|
70
74
|
<ItemDefinitionGroup>
|
|
71
75
|
<ClCompile>
|
|
72
76
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
73
77
|
<CompileAsWinRT>false</CompileAsWinRT>
|
|
74
78
|
<SDLCheck>true</SDLCheck>
|
|
75
|
-
<PreprocessorDefinitions>USE_EDGEMODE_JSRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
79
|
+
<PreprocessorDefinitions>USE_EDGEMODE_JSRT;FOLLY_NO_CONFIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
76
80
|
<!-- /Zc:strictStrings enforces the standard C++ const qualifications for
|
|
77
81
|
string literals. It prevents code like
|
|
78
82
|
wchar_t* str = L"hello";
|
|
@@ -94,6 +98,12 @@
|
|
|
94
98
|
</ItemGroup>
|
|
95
99
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
96
100
|
<ImportGroup Label="ExtensionTargets">
|
|
101
|
+
<Import Project="$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets')" />
|
|
102
|
+
<Import Project="$(V8_Package)\build\native\ReactNative.V8JSI.Windows.UWP.targets" Condition="Exists('$(V8_Package)\build\native\ReactNative.V8JSI.Windows.UWP.targets') AND '$(USE_V8)' == 'true'" />
|
|
97
103
|
</ImportGroup>
|
|
104
|
+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
105
|
+
<Error Condition="!Exists('$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\boost.1.72.0.0\build\boost.targets'))" />
|
|
106
|
+
<Error Condition="!Exists('$(V8_Package)\build\native\ReactNative.V8JSI.Windows.UWP.targets') AND '$(USE_V8)' == 'true'" Text="$([System.String]::Format('$(ErrorText)', '$(V8_Package)\build\native\ReactNative.V8JSI.Windows.UWP.targets'))" />
|
|
107
|
+
</Target>
|
|
98
108
|
<Target Name="Deploy" />
|
|
99
109
|
</Project>
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<package id="Microsoft.Windows.CppWinRT" version="2.0.200615.7" targetFramework="native" />
|
|
9
9
|
<package id="Microsoft.WinUI" version="3.0.0-preview2.200713.0" targetFramework="native"/>
|
|
10
10
|
<!-- package id="ReactNative.Hermes.Windows" version="0.5.0-f56606a8" targetFramework="native" / -->
|
|
11
|
-
<!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.63.
|
|
11
|
+
<!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.63.17" targetFramework="native" / -->
|
|
12
12
|
</packages>
|