react-native-windows 0.66.20 → 0.66.23
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 +64 -1
- package/CHANGELOG.md +31 -4
- package/Directory.Build.props +4 -0
- package/Folly/Folly.vcxproj +4 -5
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +2 -0
- package/Microsoft.ReactNative/IReactContext.idl +27 -0
- package/Microsoft.ReactNative/packages.config +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +17 -3
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +48 -0
- package/Microsoft.ReactNative.Cxx/JSValueWriter.h +1 -1
- package/PropertySheets/JSEngine.props +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/YGValue.h +94 -0
- package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +72 -2
- package/Shared/JSI/NapiJsiV8RuntimeHolder.h +2 -0
- package/Shared/OInstance.cpp +13 -13
- package/fmt/fmt.vcxproj +4 -5
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,70 @@
|
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Fri,
|
|
5
|
+
"date": "Fri, 17 Jun 2022 17:40:41 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.66.23",
|
|
7
|
+
"version": "0.66.23",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Fix use of [[maybe_unused]] attribute",
|
|
12
|
+
"author": "vmorozov@microsoft.com",
|
|
13
|
+
"commit": "4530d5e97508d8586ddce4eaa325c1fd5a0a49ee",
|
|
14
|
+
"package": "react-native-windows"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Thu, 09 Jun 2022 04:18:35 GMT",
|
|
21
|
+
"tag": "react-native-windows_v0.66.22",
|
|
22
|
+
"version": "0.66.22",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"comment": "Enable Blob module with runtime option",
|
|
27
|
+
"author": "julio.rocha@microsoft.com",
|
|
28
|
+
"commit": "acda9008283ce5637feacebedec2f82603e15eb6",
|
|
29
|
+
"package": "react-native-windows"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"comment": "Change the definition of YGUndefined from NAN to __builtin_nanf(\"0\")",
|
|
33
|
+
"author": "30809111+acoates-ms@users.noreply.github.com",
|
|
34
|
+
"commit": "11cf0605630d8998ee90a2cfd3bcf07044569f62",
|
|
35
|
+
"package": "react-native-windows"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Mon, 30 May 2022 15:09:34 GMT",
|
|
42
|
+
"tag": "react-native-windows_v0.66.21",
|
|
43
|
+
"version": "0.66.21",
|
|
44
|
+
"comments": {
|
|
45
|
+
"patch": [
|
|
46
|
+
{
|
|
47
|
+
"comment": "[0.66] Change CG registration for folly and fmt from `other` to `git`",
|
|
48
|
+
"author": "jthysell@microsoft.com",
|
|
49
|
+
"commit": "0212b1270f07799e8edbc3e9dab1005f8ada963d",
|
|
50
|
+
"package": "react-native-windows"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"comment": "Expose LoadingState on ReactContext",
|
|
54
|
+
"author": "acoates@microsoft.com",
|
|
55
|
+
"commit": "e5507fd930f21faf1d0e09478a46aee45e23a33c",
|
|
56
|
+
"package": "react-native-windows"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"comment": "Support PreparedScriptStore for V8 Node-API.",
|
|
60
|
+
"author": "vmorozov@microsoft.com",
|
|
61
|
+
"commit": "d3770bef39a097ca15b0e5552dc8a9badea40a99",
|
|
62
|
+
"package": "react-native-windows"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"date": "Fri, 27 May 2022 16:26:29 GMT",
|
|
6
69
|
"tag": "react-native-windows_v0.66.20",
|
|
7
70
|
"version": "0.66.20",
|
|
8
71
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,44 @@
|
|
|
1
1
|
# Change Log - react-native-windows
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 17 Jun 2022 17:40:41 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.66.
|
|
7
|
+
## 0.66.23
|
|
8
8
|
|
|
9
|
-
Fri,
|
|
9
|
+
Fri, 17 Jun 2022 17:40:41 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
- Fix
|
|
13
|
+
- Fix use of [[maybe_unused]] attribute (vmorozov@microsoft.com)
|
|
14
14
|
|
|
15
|
+
## 0.66.22
|
|
16
|
+
|
|
17
|
+
Thu, 09 Jun 2022 04:18:35 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Enable Blob module with runtime option (julio.rocha@microsoft.com)
|
|
22
|
+
- Change the definition of YGUndefined from NAN to __builtin_nanf("0") (30809111+acoates-ms@users.noreply.github.com)
|
|
23
|
+
|
|
24
|
+
## 0.66.21
|
|
25
|
+
|
|
26
|
+
Mon, 30 May 2022 15:09:34 GMT
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- [0.66] Change CG registration for folly and fmt from `other` to `git` (jthysell@microsoft.com)
|
|
31
|
+
- Expose LoadingState on ReactContext (acoates@microsoft.com)
|
|
32
|
+
- Support PreparedScriptStore for V8 Node-API. (vmorozov@microsoft.com)
|
|
33
|
+
|
|
34
|
+
## 0.66.20
|
|
35
|
+
|
|
36
|
+
Fri, 27 May 2022 16:26:29 GMT
|
|
37
|
+
|
|
38
|
+
### Patches
|
|
39
|
+
|
|
40
|
+
- Fix RuntimeOptions for RNW Desktop (vmorozov@microsoft.com)
|
|
41
|
+
|
|
15
42
|
## 0.66.19
|
|
16
43
|
|
|
17
44
|
Tue, 24 May 2022 21:08:55 GMT
|
package/Directory.Build.props
CHANGED
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
The PR (windows-vs-pr.yml) and CI (publish.yml() turn it back on.
|
|
19
19
|
-->
|
|
20
20
|
<EnableSourceLink Condition="'$(EnableSourceLink)' == ''">false</EnableSourceLink>
|
|
21
|
+
<!-- When bumping the Folly version, be sure to bump the git hash of that version's commit too. -->
|
|
21
22
|
<FollyVersion>2021.06.28.00</FollyVersion>
|
|
23
|
+
<FollyCommitHash>f434460f8a98e85f3ddb75390ddd1cc330c8f658</FollyCommitHash>
|
|
24
|
+
<!-- When bumping the fmt version, be sure to bump the git hash of that version's commit too. -->
|
|
22
25
|
<FmtVersion>7.1.3</FmtVersion>
|
|
26
|
+
<FmtCommitHash>7bdf0628b1276379886c7f6dda2cef2b3b374f0b</FmtCommitHash>
|
|
23
27
|
</PropertyGroup>
|
|
24
28
|
|
|
25
29
|
<PropertyGroup Label="Configuration">
|
package/Folly/Folly.vcxproj
CHANGED
|
@@ -299,11 +299,10 @@
|
|
|
299
299
|
"Registrations": [
|
|
300
300
|
{
|
|
301
301
|
"Component": {
|
|
302
|
-
"Type": "
|
|
303
|
-
"
|
|
304
|
-
"
|
|
305
|
-
"
|
|
306
|
-
"DownloadUrl": "https://github.com/facebook/folly/archive/v$(FollyVersion).zip"
|
|
302
|
+
"Type": "git",
|
|
303
|
+
"Git": {
|
|
304
|
+
"RepositoryUrl": "https://github.com/facebook/folly",
|
|
305
|
+
"CommitHash": "$(FollyCommitHash)"
|
|
307
306
|
}
|
|
308
307
|
},
|
|
309
308
|
"DevelopmentDependency": false
|
|
@@ -92,6 +92,23 @@ Windows::Foundation::IInspectable ReactContext::JSRuntime() noexcept {
|
|
|
92
92
|
return m_context->JsiRuntime();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
LoadingState ReactContext::LoadingState() noexcept {
|
|
96
|
+
switch (m_context->State()) {
|
|
97
|
+
case Mso::React::ReactInstanceState::Loading:
|
|
98
|
+
case Mso::React::ReactInstanceState::WaitingForDebugger:
|
|
99
|
+
return LoadingState::Loading;
|
|
100
|
+
case Mso::React::ReactInstanceState::Loaded:
|
|
101
|
+
return LoadingState::Loaded;
|
|
102
|
+
case Mso::React::ReactInstanceState::HasError:
|
|
103
|
+
return LoadingState::HasError;
|
|
104
|
+
case Mso::React::ReactInstanceState::Unloaded:
|
|
105
|
+
return LoadingState::Unloaded;
|
|
106
|
+
default:
|
|
107
|
+
assert(false);
|
|
108
|
+
return LoadingState::HasError;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
95
112
|
#ifndef CORE_ABI
|
|
96
113
|
// Deprecated: Use XamlUIService directly.
|
|
97
114
|
void ReactContext::DispatchEvent(
|
|
@@ -41,6 +41,8 @@ struct ReactContext : winrt::implements<ReactContext, IReactContext> {
|
|
|
41
41
|
IReactDispatcher UIDispatcher() noexcept;
|
|
42
42
|
IReactDispatcher JSDispatcher() noexcept;
|
|
43
43
|
IInspectable JSRuntime() noexcept;
|
|
44
|
+
LoadingState LoadingState() noexcept;
|
|
45
|
+
|
|
44
46
|
#ifndef CORE_ABI
|
|
45
47
|
void DispatchEvent(
|
|
46
48
|
xaml::FrameworkElement const &view,
|
|
@@ -13,6 +13,29 @@ import "IReactPropertyBag.idl";
|
|
|
13
13
|
|
|
14
14
|
namespace Microsoft.ReactNative
|
|
15
15
|
{
|
|
16
|
+
|
|
17
|
+
DOC_STRING(
|
|
18
|
+
"Used to represent the state of the React Native JavaScript instance")
|
|
19
|
+
enum LoadingState
|
|
20
|
+
{
|
|
21
|
+
DOC_STRING(
|
|
22
|
+
"The instance is loading the JavaScript bundle and initial instance setup. Calls to run JavaScript functions will be queued to run once the instance is fully loaded."
|
|
23
|
+
)
|
|
24
|
+
Loading = 0,
|
|
25
|
+
DOC_STRING(
|
|
26
|
+
"The instance is in a ready state. Calls to run JavaScript functions will be run as soon as they are posted to the JavaScript instance."
|
|
27
|
+
)
|
|
28
|
+
Loaded = 1,
|
|
29
|
+
DOC_STRING(
|
|
30
|
+
"The instance has hit an error. Calls to run JavaScript functions will not be run."
|
|
31
|
+
)
|
|
32
|
+
HasError = 2,
|
|
33
|
+
DOC_STRING(
|
|
34
|
+
"The instance has successfully unloaded. Calls to run JavaScript functions will not be run."
|
|
35
|
+
)
|
|
36
|
+
Unloaded = 3
|
|
37
|
+
};
|
|
38
|
+
|
|
16
39
|
[webhosthidden]
|
|
17
40
|
DOC_STRING("An immutable snapshot of the @ReactInstanceSettings used to create the current React instance.")
|
|
18
41
|
interface IReactSettingsSnapshot
|
|
@@ -161,5 +184,9 @@ namespace Microsoft.ReactNative
|
|
|
161
184
|
"The `paramsArgWriter` is a @JSValueArgWriter delegate that receives @IJSValueWriter to serialize "
|
|
162
185
|
"the event parameters.")
|
|
163
186
|
void EmitJSEvent(String eventEmitterName, String eventName, JSValueArgWriter paramsArgWriter);
|
|
187
|
+
|
|
188
|
+
DOC_STRING(
|
|
189
|
+
"Gets the state of the ReactNative instance.")
|
|
190
|
+
LoadingState LoadingState { get; };
|
|
164
191
|
}
|
|
165
192
|
} // namespace Microsoft.ReactNative
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<package id="Microsoft.Windows.CppWinRT" version="2.0.210312.4" targetFramework="native" />
|
|
9
9
|
<package id="Microsoft.WinUI" version="3.0.0-preview4.210210.4" targetFramework="native" />
|
|
10
10
|
<package id="ReactNative.Hermes.Windows" version="0.9.0-ms.4" targetFramework="native" />
|
|
11
|
-
<!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.65.
|
|
11
|
+
<!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.65.15" targetFramework="native" / -->
|
|
12
12
|
</packages>
|
|
@@ -440,6 +440,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
|
|
|
440
440
|
|
|
441
441
|
private: // Shared NAPI call helpers
|
|
442
442
|
napi_value RunScript(napi_value script, const char *sourceUrl);
|
|
443
|
+
napi_value RunScriptBuffer(const std::shared_ptr<const facebook::jsi::Buffer> &buffer, const char *sourceUrl);
|
|
443
444
|
std::vector<uint8_t> SerializeScript(napi_value script, const char *sourceUrl);
|
|
444
445
|
napi_value RunSerializedScript(span<const uint8_t> serialized, napi_value source, const char *sourceUrl);
|
|
445
446
|
napi_ext_ref CreateReference(napi_value value) const;
|
|
@@ -620,9 +621,7 @@ NapiJsiRuntime::NapiJsiRuntime(napi_env env) noexcept : m_env{env} {
|
|
|
620
621
|
|
|
621
622
|
Value NapiJsiRuntime::evaluateJavaScript(const shared_ptr<const Buffer> &buffer, const string &sourceUrl) {
|
|
622
623
|
EnvScope envScope{m_env};
|
|
623
|
-
napi_value
|
|
624
|
-
napi_value result = RunScript(script, sourceUrl.c_str());
|
|
625
|
-
|
|
624
|
+
napi_value result = RunScriptBuffer(buffer, sourceUrl.c_str());
|
|
626
625
|
return ToJsiValue(result);
|
|
627
626
|
}
|
|
628
627
|
|
|
@@ -1406,6 +1405,21 @@ napi_value NapiJsiRuntime::RunScript(napi_value script, const char *sourceUrl) {
|
|
|
1406
1405
|
return result;
|
|
1407
1406
|
}
|
|
1408
1407
|
|
|
1408
|
+
napi_value NapiJsiRuntime::RunScriptBuffer(
|
|
1409
|
+
const std::shared_ptr<const facebook::jsi::Buffer> &buffer,
|
|
1410
|
+
const char *sourceUrl) {
|
|
1411
|
+
napi_ext_buffer napiBuffer{};
|
|
1412
|
+
napiBuffer.buffer_object = NativeObjectWrapper<std::shared_ptr<const facebook::jsi::Buffer>>::Wrap(
|
|
1413
|
+
std::shared_ptr<const facebook::jsi::Buffer>{buffer});
|
|
1414
|
+
napiBuffer.data = buffer->data();
|
|
1415
|
+
napiBuffer.byte_size = buffer->size();
|
|
1416
|
+
|
|
1417
|
+
napi_value result{};
|
|
1418
|
+
CHECK_NAPI(napi_ext_run_script_buffer(m_env, &napiBuffer, sourceUrl, &result));
|
|
1419
|
+
|
|
1420
|
+
return result;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1409
1423
|
// Serializes script with the sourceUrl origin.
|
|
1410
1424
|
vector<uint8_t> NapiJsiRuntime::SerializeScript(napi_value script, const char *sourceUrl) {
|
|
1411
1425
|
vector<uint8_t> result;
|
|
@@ -20,6 +20,54 @@ namespace Microsoft::JSI {
|
|
|
20
20
|
///
|
|
21
21
|
std::unique_ptr<facebook::jsi::Runtime> __cdecl MakeNodeApiJsiRuntime(napi_env env) noexcept;
|
|
22
22
|
|
|
23
|
+
template <typename T>
|
|
24
|
+
struct NativeObjectWrapper;
|
|
25
|
+
|
|
26
|
+
template <typename T>
|
|
27
|
+
struct NativeObjectWrapper<std::unique_ptr<T>> {
|
|
28
|
+
static napi_ext_native_data Wrap(std::unique_ptr<T> &&obj) noexcept {
|
|
29
|
+
napi_ext_native_data nativeData{};
|
|
30
|
+
nativeData.data = obj.release();
|
|
31
|
+
nativeData.finalize_cb = [](napi_env /*env*/, void *data, void * /*finalizeHint*/) {
|
|
32
|
+
std::unique_ptr<T> obj{reinterpret_cast<T *>(data)};
|
|
33
|
+
};
|
|
34
|
+
return nativeData;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static T *Unwrap(napi_ext_native_data &nativeData) noexcept {
|
|
38
|
+
return reinterpret_cast<T *>(nativeData.data);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
template <typename T>
|
|
43
|
+
struct NativeObjectWrapper<std::shared_ptr<T>> {
|
|
44
|
+
static napi_ext_native_data Wrap(std::shared_ptr<T> &&obj) noexcept {
|
|
45
|
+
static_assert(
|
|
46
|
+
sizeof(SharedPtrHolder) == sizeof(std::shared_ptr<T>), "std::shared_ptr expected to have size of two pointers");
|
|
47
|
+
SharedPtrHolder ptrHolder;
|
|
48
|
+
new (std::addressof(ptrHolder)) std::shared_ptr(std::move(obj));
|
|
49
|
+
napi_ext_native_data nativeData{};
|
|
50
|
+
nativeData.data = ptrHolder.ptr1;
|
|
51
|
+
nativeData.finalize_hint = ptrHolder.ptr2;
|
|
52
|
+
nativeData.finalize_cb = [](napi_env /*env*/, void *data, void *finalizeHint) {
|
|
53
|
+
SharedPtrHolder ptrHolder{data, finalizeHint};
|
|
54
|
+
std::shared_ptr<T> obj(std::move(*reinterpret_cast<std::shared_ptr<T> *>(std::addressof(ptrHolder))));
|
|
55
|
+
};
|
|
56
|
+
return nativeData;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static std::shared_ptr<T> Unwrap(napi_ext_native_data &nativeData) noexcept {
|
|
60
|
+
SharedPtrHolder ptrHolder{nativeData.data, nativeData.finalize_hint};
|
|
61
|
+
return *reinterpret_cast<std::shared_ptr<T> *>(std::addressof(ptrHolder));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private:
|
|
65
|
+
struct SharedPtrHolder {
|
|
66
|
+
void *ptr1;
|
|
67
|
+
void *ptr2;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
23
71
|
} // namespace Microsoft::JSI
|
|
24
72
|
|
|
25
73
|
#endif // MICROSOFT_REACTNATIVE_JSI_NODEAPIJSIRUNTIME
|
|
@@ -287,7 +287,7 @@ inline JSValueArgWriter MakeJSValueWriter(T &&argWriter) noexcept {
|
|
|
287
287
|
|
|
288
288
|
template <class... TArgs>
|
|
289
289
|
inline JSValueArgWriter MakeJSValueWriter(TArgs &&... args) noexcept {
|
|
290
|
-
return [&args...](
|
|
290
|
+
return [&args...]([[maybe_unused]] IJSValueWriter const &writer) noexcept { (WriteValue(writer, args), ...); };
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<EnableDevServerHBCBundles Condition="'$(EnableDevServerHBCBundles)' == ''">false</EnableDevServerHBCBundles>
|
|
17
17
|
|
|
18
18
|
<UseV8 Condition="'$(UseV8)' == ''">false</UseV8>
|
|
19
|
-
<V8Version Condition="'$(V8Version)' == ''">0.65.
|
|
19
|
+
<V8Version Condition="'$(V8Version)' == ''">0.65.15</V8Version>
|
|
20
20
|
<V8PackageName>ReactNative.V8Jsi.Windows</V8PackageName>
|
|
21
21
|
<V8PackageName Condition="'$(V8AppPlatform)' != 'win32'">$(V8PackageName).UWP</V8PackageName>
|
|
22
22
|
<V8Package>$(SolutionDir)packages\$(V8PackageName).$(V8Version)</V8Package>
|
|
@@ -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
|
|
@@ -77,17 +77,20 @@ NapiJsiV8RuntimeHolder::NapiJsiV8RuntimeHolder(
|
|
|
77
77
|
m_preparedScriptStore{std::move(preparedScriptStore)} {}
|
|
78
78
|
|
|
79
79
|
void NapiJsiV8RuntimeHolder::InitRuntime() noexcept {
|
|
80
|
-
napi_env env{};
|
|
81
80
|
napi_ext_env_settings settings{};
|
|
82
81
|
settings.this_size = sizeof(settings);
|
|
83
|
-
settings.flags.enable_gc_api = true;
|
|
84
82
|
if (m_debuggerPort > 0)
|
|
85
83
|
settings.inspector_port = m_debuggerPort;
|
|
86
84
|
|
|
87
85
|
settings.flags.enable_inspector = m_useDirectDebugger;
|
|
88
86
|
settings.flags.wait_for_debugger = m_debuggerBreakOnNextLine;
|
|
87
|
+
// TODO: args.debuggerRuntimeName = debuggerRuntimeName_;
|
|
89
88
|
settings.foreground_scheduler = &NapiJsiV8RuntimeHolder::ScheduleTaskCallback;
|
|
90
89
|
|
|
90
|
+
napi_ext_script_cache scriptCache = InitScriptCache(std::move(m_preparedScriptStore));
|
|
91
|
+
settings.script_cache = &scriptCache;
|
|
92
|
+
|
|
93
|
+
napi_env env{};
|
|
91
94
|
napi_ext_create_env(&settings, &env);
|
|
92
95
|
// Associate environment to holder.
|
|
93
96
|
napi_set_instance_data(env, this, nullptr /*finalize_cb*/, nullptr /*finalize_hint*/);
|
|
@@ -96,6 +99,73 @@ void NapiJsiV8RuntimeHolder::InitRuntime() noexcept {
|
|
|
96
99
|
m_ownThreadId = std::this_thread::get_id();
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
struct NodeApiJsiBuffer : facebook::jsi::Buffer {
|
|
103
|
+
static std::shared_ptr<const facebook::jsi::Buffer> CreateJsiBuffer(const napi_ext_buffer *buffer) {
|
|
104
|
+
if (buffer && buffer->data) {
|
|
105
|
+
return std::shared_ptr<const facebook::jsi::Buffer>(new NodeApiJsiBuffer(buffer));
|
|
106
|
+
} else {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
NodeApiJsiBuffer(const napi_ext_buffer *buffer) noexcept : buffer_(*buffer) {}
|
|
112
|
+
|
|
113
|
+
~NodeApiJsiBuffer() override {
|
|
114
|
+
if (buffer_.buffer_object.finalize_cb) {
|
|
115
|
+
buffer_.buffer_object.finalize_cb(nullptr, buffer_.buffer_object.data, buffer_.buffer_object.finalize_hint);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const uint8_t *data() const override {
|
|
120
|
+
return buffer_.data;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
size_t size() const override {
|
|
124
|
+
return buffer_.byte_size;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private:
|
|
128
|
+
napi_ext_buffer buffer_;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
napi_ext_script_cache NapiJsiV8RuntimeHolder::InitScriptCache(
|
|
132
|
+
unique_ptr<PreparedScriptStore> &&preparedScriptStore) noexcept {
|
|
133
|
+
napi_ext_script_cache scriptCache{};
|
|
134
|
+
scriptCache.cache_object = NativeObjectWrapper<unique_ptr<PreparedScriptStore>>::Wrap(std::move(preparedScriptStore));
|
|
135
|
+
scriptCache.load_cached_script = [](napi_env env,
|
|
136
|
+
napi_ext_script_cache *script_cache,
|
|
137
|
+
napi_ext_cached_script_metadata *script_metadata,
|
|
138
|
+
napi_ext_buffer *result) -> napi_status {
|
|
139
|
+
PreparedScriptStore *scriptStore = reinterpret_cast<PreparedScriptStore *>(script_cache->cache_object.data);
|
|
140
|
+
std::shared_ptr<const facebook::jsi::Buffer> buffer = scriptStore->tryGetPreparedScript(
|
|
141
|
+
ScriptSignature{script_metadata->source_url, script_metadata->source_hash},
|
|
142
|
+
JSRuntimeSignature{script_metadata->runtime_name, script_metadata->runtime_version},
|
|
143
|
+
script_metadata->tag);
|
|
144
|
+
if (buffer) {
|
|
145
|
+
result->buffer_object = NativeObjectWrapper<std::shared_ptr<const facebook::jsi::Buffer>>::Wrap(
|
|
146
|
+
std::shared_ptr<const facebook::jsi::Buffer>{buffer});
|
|
147
|
+
result->data = buffer->data();
|
|
148
|
+
result->byte_size = buffer->size();
|
|
149
|
+
} else {
|
|
150
|
+
*result = napi_ext_buffer{};
|
|
151
|
+
}
|
|
152
|
+
return napi_ok;
|
|
153
|
+
};
|
|
154
|
+
scriptCache.store_cached_script = [](napi_env env,
|
|
155
|
+
napi_ext_script_cache *script_cache,
|
|
156
|
+
napi_ext_cached_script_metadata *script_metadata,
|
|
157
|
+
const napi_ext_buffer *buffer) -> napi_status {
|
|
158
|
+
PreparedScriptStore *scriptStore = reinterpret_cast<PreparedScriptStore *>(script_cache->cache_object.data);
|
|
159
|
+
scriptStore->persistPreparedScript(
|
|
160
|
+
NodeApiJsiBuffer::CreateJsiBuffer(buffer),
|
|
161
|
+
ScriptSignature{script_metadata->source_url, script_metadata->source_hash},
|
|
162
|
+
JSRuntimeSignature{script_metadata->runtime_name, script_metadata->runtime_version},
|
|
163
|
+
script_metadata->tag);
|
|
164
|
+
return napi_ok;
|
|
165
|
+
};
|
|
166
|
+
return scriptCache;
|
|
167
|
+
}
|
|
168
|
+
|
|
99
169
|
#pragma region Microsoft::JSI::RuntimeHolderLazyInit
|
|
100
170
|
|
|
101
171
|
facebook::react::JSIEngineOverride NapiJsiV8RuntimeHolder::getRuntimeType() noexcept {
|
|
@@ -31,6 +31,8 @@ class NapiJsiV8RuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
|
|
|
31
31
|
void *finalizeHint);
|
|
32
32
|
|
|
33
33
|
void InitRuntime() noexcept;
|
|
34
|
+
napi_ext_script_cache InitScriptCache(
|
|
35
|
+
std::unique_ptr<facebook::jsi::PreparedScriptStore> &&preparedScriptStore) noexcept;
|
|
34
36
|
|
|
35
37
|
std::shared_ptr<facebook::jsi::Runtime> m_runtime;
|
|
36
38
|
std::shared_ptr<facebook::react::MessageQueueThread> m_jsQueue;
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -614,20 +614,20 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
|
|
|
614
614
|
[]() { return std::make_unique<StatusBarManagerModule>(); },
|
|
615
615
|
nativeQueue));
|
|
616
616
|
|
|
617
|
-
//
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
617
|
+
// #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership.
|
|
618
|
+
if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule")) {
|
|
619
|
+
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
620
|
+
m_innerInstance,
|
|
621
|
+
Microsoft::React::GetBlobModuleName(),
|
|
622
|
+
[transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); },
|
|
623
|
+
nativeQueue));
|
|
624
624
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
625
|
+
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
626
|
+
m_innerInstance,
|
|
627
|
+
Microsoft::React::GetFileReaderModuleName(),
|
|
628
|
+
[transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); },
|
|
629
|
+
nativeQueue));
|
|
630
|
+
}
|
|
631
631
|
|
|
632
632
|
return modules;
|
|
633
633
|
}
|
package/fmt/fmt.vcxproj
CHANGED
|
@@ -114,11 +114,10 @@
|
|
|
114
114
|
"Registrations": [
|
|
115
115
|
{
|
|
116
116
|
"Component": {
|
|
117
|
-
"Type": "
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"DownloadUrl": "https://github.com/fmtlib/fmt/archive/refs/tags/$(FmtVersion).zip"
|
|
117
|
+
"Type": "git",
|
|
118
|
+
"Git": {
|
|
119
|
+
"RepositoryUrl": "https://github.com/fmtlib/fmt",
|
|
120
|
+
"CommitHash": "$(FmtCommitHash)"
|
|
122
121
|
}
|
|
123
122
|
},
|
|
124
123
|
"DevelopmentDependency": false
|