react-native-windows 0.67.2 → 0.67.3
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 +48 -0
- package/CHANGELOG.md +24 -5
- package/Microsoft.ReactNative/IReactContext.cpp +4 -0
- package/Microsoft.ReactNative/IReactContext.h +3 -2
- package/Microsoft.ReactNative/IReactContext.idl +6 -0
- package/Microsoft.ReactNative/JSDispatcherWriter.cpp +101 -0
- package/Microsoft.ReactNative/JSDispatcherWriter.h +44 -0
- package/Microsoft.ReactNative/JsiWriter.cpp +1 -13
- package/Microsoft.ReactNative/JsiWriter.h +0 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +6 -0
- package/Microsoft.ReactNative/ReactHost/React.h +2 -0
- package/Microsoft.ReactNative/ReactHost/ReactContext.cpp +7 -0
- package/Microsoft.ReactNative/ReactHost/ReactContext.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +5 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.h +12 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +8 -2
- package/Microsoft.ReactNative/ReactNativeHost.cpp +1 -0
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +146 -145
- package/Microsoft.ReactNative/TurboModulesProvider.h +5 -10
- package/Microsoft.ReactNative/Views/ScrollViewManager.cpp +0 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/Shared/Modules/PlatformConstantsModule.cpp +4 -0
- package/Shared/OInstance.cpp +0 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Mon, 28 Feb 2022 16:14:37 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.67.3",
|
|
7
|
+
"version": "0.67.3",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "vmorozov@microsoft.com",
|
|
12
|
+
"package": "react-native-windows",
|
|
13
|
+
"commit": "502c215df9c2082305e160e3d8000428cbdeba4d",
|
|
14
|
+
"comment": "Enable TurboModule Promise completion from any thread (#9595)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "tudor.mihai@microsoft.com",
|
|
18
|
+
"package": "react-native-windows",
|
|
19
|
+
"commit": "0cd8d8f044a6d619846bce470a8537fa608ada85",
|
|
20
|
+
"comment": "Expose InlineSourceMap property"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "30809111+acoates-ms@users.noreply.github.com",
|
|
24
|
+
"package": "react-native-windows",
|
|
25
|
+
"commit": "cd3b6fdbf9ea0b3d0fd18a3afa236b0fbc713c3d",
|
|
26
|
+
"comment": "Crash when getting Platform.osVersion on Windows 8.1"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Mon, 21 Feb 2022 16:18:09 GMT",
|
|
33
|
+
"tag": "react-native-windows_v0.67.2",
|
|
34
|
+
"version": "0.67.2",
|
|
35
|
+
"comments": {
|
|
36
|
+
"patch": [
|
|
37
|
+
{
|
|
38
|
+
"author": "30809111+acoates-ms@users.noreply.github.com",
|
|
39
|
+
"package": "react-native-windows",
|
|
40
|
+
"commit": "not available",
|
|
41
|
+
"comment": "Use temporary folder to store V8 JS bytecode"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "beachball",
|
|
45
|
+
"package": "react-native-windows",
|
|
46
|
+
"comment": "Bump @react-native-windows/cli to v0.67.1",
|
|
47
|
+
"commit": "521c5b633b4f28a546d12ee44a21f9d47c5e8b9e"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
4
52
|
{
|
|
5
53
|
"date": "Mon, 21 Feb 2022 16:17:54 GMT",
|
|
6
54
|
"tag": "react-native-windows_v0.67.2",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
# Change Log - react-native-windows
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 28 Feb 2022 16:14:37 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.67.
|
|
7
|
+
## 0.67.3
|
|
8
8
|
|
|
9
|
-
Mon,
|
|
9
|
+
Mon, 28 Feb 2022 16:14:37 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
13
|
+
- Enable TurboModule Promise completion from any thread (#9595) (vmorozov@microsoft.com)
|
|
14
|
+
- Expose InlineSourceMap property (tudor.mihai@microsoft.com)
|
|
15
|
+
- Crash when getting Platform.osVersion on Windows 8.1 (30809111+acoates-ms@users.noreply.github.com)
|
|
15
16
|
|
|
17
|
+
## 0.67.2
|
|
18
|
+
|
|
19
|
+
Mon, 21 Feb 2022 16:18:09 GMT
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- Use temporary folder to store V8 JS bytecode (30809111+acoates-ms@users.noreply.github.com)
|
|
24
|
+
- Bump @react-native-windows/cli to v0.67.1
|
|
25
|
+
|
|
26
|
+
## 0.67.2
|
|
27
|
+
|
|
28
|
+
Mon, 21 Feb 2022 16:17:54 GMT
|
|
29
|
+
|
|
30
|
+
### Patches
|
|
31
|
+
|
|
32
|
+
- Use temporary folder to store V8 JS bytecode (30809111+acoates-ms@users.noreply.github.com)
|
|
33
|
+
- Bump @react-native-windows/cli to v0.67.1
|
|
34
|
+
|
|
16
35
|
## 0.67.1
|
|
17
36
|
|
|
18
37
|
Mon, 07 Feb 2022 16:12:57 GMT
|
|
@@ -53,6 +53,10 @@ uint16_t ReactSettingsSnapshot::SourceBundlePort() const noexcept {
|
|
|
53
53
|
return m_settings->SourceBundlePort();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
bool ReactSettingsSnapshot::RequestInlineSourceMap() const noexcept {
|
|
57
|
+
return m_settings->RequestInlineSourceMap();
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
hstring ReactSettingsSnapshot::JavaScriptBundleFile() const noexcept {
|
|
57
61
|
return winrt::to_hstring(m_settings->JavaScriptBundleFile());
|
|
58
62
|
}
|
|
@@ -21,6 +21,7 @@ struct ReactSettingsSnapshot : winrt::implements<ReactSettingsSnapshot, IReactSe
|
|
|
21
21
|
hstring BundleRootPath() const noexcept;
|
|
22
22
|
hstring SourceBundleHost() const noexcept;
|
|
23
23
|
uint16_t SourceBundlePort() const noexcept;
|
|
24
|
+
bool RequestInlineSourceMap() const noexcept;
|
|
24
25
|
hstring JavaScriptBundleFile() const noexcept;
|
|
25
26
|
|
|
26
27
|
public:
|
|
@@ -57,8 +58,8 @@ struct ReactContext : winrt::implements<ReactContext, IReactContext> {
|
|
|
57
58
|
JSValueArgWriter const ¶msArgWriter) noexcept;
|
|
58
59
|
|
|
59
60
|
public: // IReactContext
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
// Not part of the public ABI interface
|
|
62
|
+
// Internal accessor for within the Microsoft.ReactNative dll to allow calling into internal methods
|
|
62
63
|
Mso::React::IReactContext &GetInner() const noexcept;
|
|
63
64
|
|
|
64
65
|
private:
|
|
@@ -84,6 +84,12 @@ namespace Microsoft.ReactNative
|
|
|
84
84
|
"that will be used to load the bundle from.")
|
|
85
85
|
UInt16 SourceBundlePort { get; };
|
|
86
86
|
|
|
87
|
+
DOC_STRING(
|
|
88
|
+
"A read-only snapshot of the @ReactInstanceSettings.RequestInlineSourceMap property value "
|
|
89
|
+
"at the time when the React instance was created.\n"
|
|
90
|
+
"If set, the bundler will include the source maps inline (this will improve debugging experience, but for very large bundles it could have a significant performance hit)")
|
|
91
|
+
Boolean RequestInlineSourceMap { get; };
|
|
92
|
+
|
|
87
93
|
DOC_STRING(
|
|
88
94
|
"A read-only snapshot of the @ReactInstanceSettings.JavaScriptBundleFile property value "
|
|
89
95
|
"at the time when the React instance was created.\n"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "JSDispatcherWriter.h"
|
|
6
|
+
#include <JSI/JSIDynamic.h>
|
|
7
|
+
#include <crash/verifyElseCrash.h>
|
|
8
|
+
|
|
9
|
+
namespace winrt::Microsoft::ReactNative {
|
|
10
|
+
|
|
11
|
+
//===========================================================================
|
|
12
|
+
// JSDispatcherWriter implementation
|
|
13
|
+
//===========================================================================
|
|
14
|
+
|
|
15
|
+
JSDispatcherWriter::JSDispatcherWriter(
|
|
16
|
+
IReactDispatcher const &jsDispatcher,
|
|
17
|
+
facebook::jsi::Runtime &jsiRuntime) noexcept
|
|
18
|
+
: m_jsDispatcher(jsDispatcher), m_jsiRuntime(jsiRuntime) {}
|
|
19
|
+
|
|
20
|
+
void JSDispatcherWriter::WithResultArgs(
|
|
21
|
+
Mso::Functor<void(facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t argCount)>
|
|
22
|
+
handler) noexcept {
|
|
23
|
+
if (m_jsDispatcher.HasThreadAccess()) {
|
|
24
|
+
VerifyElseCrash(!m_dynamicWriter);
|
|
25
|
+
const facebook::jsi::Value *args{nullptr};
|
|
26
|
+
size_t argCount{0};
|
|
27
|
+
m_jsiWriter->AccessResultAsArgs(args, argCount);
|
|
28
|
+
handler(m_jsiRuntime, args, argCount);
|
|
29
|
+
} else {
|
|
30
|
+
VerifyElseCrash(!m_jsiWriter);
|
|
31
|
+
folly::dynamic dynValue = m_dynamicWriter->TakeValue();
|
|
32
|
+
m_jsDispatcher.Post([handler, dynValue, &runtime = m_jsiRuntime]() {
|
|
33
|
+
VerifyElseCrash(dynValue.isArray());
|
|
34
|
+
std::vector<facebook::jsi::Value> args;
|
|
35
|
+
args.reserve(dynValue.size());
|
|
36
|
+
for (auto const &item : dynValue) {
|
|
37
|
+
args.emplace_back(facebook::jsi::valueFromDynamic(runtime, item));
|
|
38
|
+
}
|
|
39
|
+
handler(runtime, args.data(), args.size());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void JSDispatcherWriter::WriteNull() noexcept {
|
|
45
|
+
GetWriter().WriteNull();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void JSDispatcherWriter::WriteBoolean(bool value) noexcept {
|
|
49
|
+
GetWriter().WriteBoolean(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void JSDispatcherWriter::WriteInt64(int64_t value) noexcept {
|
|
53
|
+
GetWriter().WriteInt64(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void JSDispatcherWriter::WriteDouble(double value) noexcept {
|
|
57
|
+
GetWriter().WriteDouble(value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void JSDispatcherWriter::WriteString(const winrt::hstring &value) noexcept {
|
|
61
|
+
GetWriter().WriteString(value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void JSDispatcherWriter::WriteObjectBegin() noexcept {
|
|
65
|
+
GetWriter().WriteObjectBegin();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void JSDispatcherWriter::WritePropertyName(const winrt::hstring &name) noexcept {
|
|
69
|
+
GetWriter().WritePropertyName(name);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void JSDispatcherWriter::WriteObjectEnd() noexcept {
|
|
73
|
+
GetWriter().WriteObjectEnd();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void JSDispatcherWriter::WriteArrayBegin() noexcept {
|
|
77
|
+
GetWriter().WriteArrayBegin();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
void JSDispatcherWriter::WriteArrayEnd() noexcept {
|
|
81
|
+
GetWriter().WriteArrayEnd();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
IJSValueWriter JSDispatcherWriter::GetWriter() noexcept {
|
|
85
|
+
if (m_jsDispatcher.HasThreadAccess()) {
|
|
86
|
+
VerifyElseCrash(!m_dynamicWriter);
|
|
87
|
+
if (!m_jsiWriter) {
|
|
88
|
+
m_jsiWriter = winrt::make_self<JsiWriter>(m_jsiRuntime);
|
|
89
|
+
m_writer = m_jsiWriter.as<IJSValueWriter>();
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
VerifyElseCrash(!m_jsiWriter);
|
|
93
|
+
if (!m_dynamicWriter) {
|
|
94
|
+
m_dynamicWriter = winrt::make_self<DynamicWriter>();
|
|
95
|
+
m_writer = m_dynamicWriter.as<IJSValueWriter>();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return m_writer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include <functional/functor.h>
|
|
6
|
+
#include "DynamicWriter.h"
|
|
7
|
+
#include "JsiWriter.h"
|
|
8
|
+
#include "folly/dynamic.h"
|
|
9
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
10
|
+
|
|
11
|
+
namespace winrt::Microsoft::ReactNative {
|
|
12
|
+
|
|
13
|
+
// IJSValueWriter to ensure that JsiWriter is always used from JSDispatcher.
|
|
14
|
+
// In case if writing is done outside of JSDispatcher, it uses DynamicWriter to create
|
|
15
|
+
// folly::dynamic which then is written to JsiWriter in JSDispatcher.
|
|
16
|
+
struct JSDispatcherWriter : winrt::implements<JSDispatcherWriter, IJSValueWriter> {
|
|
17
|
+
JSDispatcherWriter(IReactDispatcher const &jsDispatcher, facebook::jsi::Runtime &jsiRuntime) noexcept;
|
|
18
|
+
void WithResultArgs(Mso::Functor<void(facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t argCount)>
|
|
19
|
+
handler) noexcept;
|
|
20
|
+
|
|
21
|
+
public: // IJSValueWriter
|
|
22
|
+
void WriteNull() noexcept;
|
|
23
|
+
void WriteBoolean(bool value) noexcept;
|
|
24
|
+
void WriteInt64(int64_t value) noexcept;
|
|
25
|
+
void WriteDouble(double value) noexcept;
|
|
26
|
+
void WriteString(const winrt::hstring &value) noexcept;
|
|
27
|
+
void WriteObjectBegin() noexcept;
|
|
28
|
+
void WritePropertyName(const winrt::hstring &name) noexcept;
|
|
29
|
+
void WriteObjectEnd() noexcept;
|
|
30
|
+
void WriteArrayBegin() noexcept;
|
|
31
|
+
void WriteArrayEnd() noexcept;
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
IJSValueWriter GetWriter() noexcept;
|
|
35
|
+
|
|
36
|
+
private:
|
|
37
|
+
IReactDispatcher m_jsDispatcher;
|
|
38
|
+
facebook::jsi::Runtime &m_jsiRuntime;
|
|
39
|
+
winrt::com_ptr<DynamicWriter> m_dynamicWriter;
|
|
40
|
+
winrt::com_ptr<JsiWriter> m_jsiWriter;
|
|
41
|
+
IJSValueWriter m_writer;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -61,7 +61,7 @@ void JsiWriter::WriteDouble(double value) noexcept {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
void JsiWriter::WriteString(const winrt::hstring &value) noexcept {
|
|
64
|
-
WriteValue({
|
|
64
|
+
WriteValue({facebook::jsi::String::createFromUtf8(m_runtime, winrt::to_string(value))});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
void JsiWriter::WriteObjectBegin() noexcept {
|
|
@@ -163,16 +163,4 @@ void JsiWriter::Push(Container &&container) noexcept {
|
|
|
163
163
|
m_containers.push_back(std::move(container));
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/*static*/ facebook::jsi::Value JsiWriter::ToJsiValue(
|
|
167
|
-
facebook::jsi::Runtime &runtime,
|
|
168
|
-
JSValueArgWriter const &argWriter) noexcept {
|
|
169
|
-
if (argWriter) {
|
|
170
|
-
IJSValueWriter jsiWriter = winrt::make<JsiWriter>(runtime);
|
|
171
|
-
argWriter(jsiWriter);
|
|
172
|
-
return jsiWriter.as<JsiWriter>()->MoveResult();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return {};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
166
|
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -35,9 +35,6 @@ struct JsiWriter : winrt::implements<JsiWriter, IJSValueWriter> {
|
|
|
35
35
|
void WriteArrayBegin() noexcept;
|
|
36
36
|
void WriteArrayEnd() noexcept;
|
|
37
37
|
|
|
38
|
-
public:
|
|
39
|
-
static facebook::jsi::Value ToJsiValue(facebook::jsi::Runtime &runtime, JSValueArgWriter const &argWriter) noexcept;
|
|
40
|
-
|
|
41
38
|
private:
|
|
42
39
|
enum class ContainerState {
|
|
43
40
|
AcceptValueAndFinish,
|
|
@@ -194,6 +194,9 @@
|
|
|
194
194
|
<ClInclude Include="DynamicWriter.h">
|
|
195
195
|
<DependentUpon>IJSValueWriter.idl</DependentUpon>
|
|
196
196
|
</ClInclude>
|
|
197
|
+
<ClInclude Include="JSDispatcherWriter.h">
|
|
198
|
+
<DependentUpon>IJSValueWriter.idl</DependentUpon>
|
|
199
|
+
</ClInclude>
|
|
197
200
|
<ClInclude Include="GlyphViewManager.h" />
|
|
198
201
|
<ClInclude Include="HResult.h" />
|
|
199
202
|
<ClInclude Include="IReactDispatcher.h">
|
|
@@ -524,6 +527,9 @@
|
|
|
524
527
|
<ClCompile Include="DynamicWriter.cpp">
|
|
525
528
|
<DependentUpon>IJSValueWriter.idl</DependentUpon>
|
|
526
529
|
</ClCompile>
|
|
530
|
+
<ClCompile Include="JSDispatcherWriter.cpp">
|
|
531
|
+
<DependentUpon>IJSValueWriter.idl</DependentUpon>
|
|
532
|
+
</ClCompile>
|
|
527
533
|
<ClCompile Include="GlyphViewManager.cpp" />
|
|
528
534
|
<ClCompile Include="IReactDispatcher.cpp">
|
|
529
535
|
<DependentUpon>IReactDispatcher.idl</DependentUpon>
|
|
@@ -102,6 +102,7 @@ struct IReactSettingsSnapshot : IUnknown {
|
|
|
102
102
|
virtual std::string BundleRootPath() const noexcept = 0;
|
|
103
103
|
virtual std::string SourceBundleHost() const noexcept = 0;
|
|
104
104
|
virtual uint16_t SourceBundlePort() const noexcept = 0;
|
|
105
|
+
virtual bool RequestInlineSourceMap() const noexcept = 0;
|
|
105
106
|
virtual std::string JavaScriptBundleFile() const noexcept = 0;
|
|
106
107
|
virtual bool UseDeveloperSupport() const noexcept = 0;
|
|
107
108
|
virtual JSIEngine JsiEngine() const noexcept = 0;
|
|
@@ -149,6 +150,7 @@ struct ReactDevOptions {
|
|
|
149
150
|
//! Specify a value for a component, or leave empty to use the default.
|
|
150
151
|
std::string SourceBundleHost; // Host domain (without port) for the bundler server. Default: "localhost".
|
|
151
152
|
uint16_t SourceBundlePort{0}; // Host port for the bundler server. Default: "8081".
|
|
153
|
+
bool RequestInlineSourceMap{true}; // Request the source map inline
|
|
152
154
|
std::string SourceBundleName; // Bundle name without any extension (e.g. "index.win32"). Default: "index.{PLATFORM}"
|
|
153
155
|
std::string SourceBundleExtension; // Bundle name extension. Default: ".bundle".
|
|
154
156
|
|
|
@@ -79,6 +79,13 @@ uint16_t ReactSettingsSnapshot::SourceBundlePort() const noexcept {
|
|
|
79
79
|
return 0;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
bool ReactSettingsSnapshot::RequestInlineSourceMap() const noexcept {
|
|
83
|
+
if (auto instance = m_reactInstance.GetStrongPtr()) {
|
|
84
|
+
return instance->RequestInlineSourceMap();
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
82
89
|
std::string ReactSettingsSnapshot::JavaScriptBundleFile() const noexcept {
|
|
83
90
|
if (auto instance = m_reactInstance.GetStrongPtr()) {
|
|
84
91
|
return instance->JavaScriptBundleFile();
|
|
@@ -27,6 +27,7 @@ class ReactSettingsSnapshot final : public Mso::UnknownObject<IReactSettingsSnap
|
|
|
27
27
|
std::string BundleRootPath() const noexcept override;
|
|
28
28
|
std::string SourceBundleHost() const noexcept override;
|
|
29
29
|
uint16_t SourceBundlePort() const noexcept override;
|
|
30
|
+
bool RequestInlineSourceMap() const noexcept override;
|
|
30
31
|
std::string JavaScriptBundleFile() const noexcept override;
|
|
31
32
|
bool UseDeveloperSupport() const noexcept override;
|
|
32
33
|
JSIEngine JsiEngine() const noexcept override;
|
|
@@ -383,6 +383,7 @@ void ReactInstanceWin::Initialize() noexcept {
|
|
|
383
383
|
devSettings->useJITCompilation = m_options.EnableJITCompilation;
|
|
384
384
|
devSettings->sourceBundleHost = SourceBundleHost();
|
|
385
385
|
devSettings->sourceBundlePort = SourceBundlePort();
|
|
386
|
+
devSettings->inlineSourceMap = RequestInlineSourceMap();
|
|
386
387
|
devSettings->debugBundlePath = DebugBundlePath();
|
|
387
388
|
devSettings->liveReloadCallback = GetLiveReloadCallback();
|
|
388
389
|
devSettings->errorCallback = GetErrorCallback();
|
|
@@ -443,7 +444,6 @@ void ReactInstanceWin::Initialize() noexcept {
|
|
|
443
444
|
case JSIEngine::Hermes:
|
|
444
445
|
devSettings->jsiRuntimeHolder =
|
|
445
446
|
std::make_shared<facebook::react::HermesRuntimeHolder>(devSettings, m_jsMessageThread.Load());
|
|
446
|
-
devSettings->inlineSourceMap = false;
|
|
447
447
|
break;
|
|
448
448
|
case JSIEngine::V8:
|
|
449
449
|
#if defined(USE_V8)
|
|
@@ -1061,6 +1061,10 @@ uint16_t ReactInstanceWin::SourceBundlePort() const noexcept {
|
|
|
1061
1061
|
: facebook::react::DevServerHelper::DefaultPackagerPort;
|
|
1062
1062
|
}
|
|
1063
1063
|
|
|
1064
|
+
bool ReactInstanceWin::RequestInlineSourceMap() const noexcept {
|
|
1065
|
+
return m_options.DeveloperSettings.RequestInlineSourceMap;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1064
1068
|
JSIEngine ReactInstanceWin::JsiEngine() const noexcept {
|
|
1065
1069
|
return m_options.JsiEngine();
|
|
1066
1070
|
}
|
|
@@ -78,6 +78,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
78
78
|
std::string BundleRootPath() const noexcept;
|
|
79
79
|
std::string SourceBundleHost() const noexcept;
|
|
80
80
|
uint16_t SourceBundlePort() const noexcept;
|
|
81
|
+
bool RequestInlineSourceMap() const noexcept;
|
|
81
82
|
std::string JavaScriptBundleFile() const noexcept;
|
|
82
83
|
bool UseDeveloperSupport() const noexcept;
|
|
83
84
|
JSIEngine JsiEngine() const noexcept;
|
|
@@ -130,6 +130,9 @@ struct ReactInstanceSettings : ReactInstanceSettingsT<ReactInstanceSettings> {
|
|
|
130
130
|
uint16_t SourceBundlePort() noexcept;
|
|
131
131
|
void SourceBundlePort(uint16_t value) noexcept;
|
|
132
132
|
|
|
133
|
+
bool RequestInlineSourceMap() noexcept;
|
|
134
|
+
void RequestInlineSourceMap(bool value) noexcept;
|
|
135
|
+
|
|
133
136
|
JSIEngine JSIEngineOverride() noexcept;
|
|
134
137
|
void JSIEngineOverride(JSIEngine value) noexcept;
|
|
135
138
|
|
|
@@ -174,6 +177,7 @@ struct ReactInstanceSettings : ReactInstanceSettingsT<ReactInstanceSettings> {
|
|
|
174
177
|
hstring m_sourceBundleHost{};
|
|
175
178
|
hstring m_debuggerRuntimeName{};
|
|
176
179
|
uint16_t m_sourceBundlePort{0};
|
|
180
|
+
bool m_requestInlineSourceMap{true};
|
|
177
181
|
LogHandler m_nativeLogger{nullptr};
|
|
178
182
|
|
|
179
183
|
#if USE_HERMES
|
|
@@ -308,6 +312,14 @@ inline void ReactInstanceSettings::SourceBundlePort(uint16_t value) noexcept {
|
|
|
308
312
|
m_sourceBundlePort = value;
|
|
309
313
|
}
|
|
310
314
|
|
|
315
|
+
inline bool ReactInstanceSettings::RequestInlineSourceMap() noexcept {
|
|
316
|
+
return m_requestInlineSourceMap;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
inline void ReactInstanceSettings::RequestInlineSourceMap(bool value) noexcept {
|
|
320
|
+
m_requestInlineSourceMap = value;
|
|
321
|
+
}
|
|
322
|
+
|
|
311
323
|
inline JSIEngine ReactInstanceSettings::JSIEngineOverride() noexcept {
|
|
312
324
|
return m_jSIEngineOverride;
|
|
313
325
|
}
|
|
@@ -204,17 +204,23 @@ namespace Microsoft.ReactNative
|
|
|
204
204
|
IReactDispatcher UIDispatcher { get; set; };
|
|
205
205
|
|
|
206
206
|
DOC_STRING(
|
|
207
|
-
"When using
|
|
207
|
+
"When using @.UseFastRefresh, @.UseLiveReload, or @.UseWebDebugger this is the server hostname "
|
|
208
208
|
"that will be used to load the bundle from.")
|
|
209
209
|
DOC_DEFAULT("localhost")
|
|
210
210
|
String SourceBundleHost { get; set; };
|
|
211
211
|
|
|
212
212
|
DOC_STRING(
|
|
213
|
-
"When using
|
|
213
|
+
"When using @.UseFastRefresh, @.UseLiveReload, or @.UseWebDebugger this is the server port "
|
|
214
214
|
"that will be used to load the bundle from.")
|
|
215
215
|
DOC_DEFAULT("8081")
|
|
216
216
|
UInt16 SourceBundlePort { get; set; };
|
|
217
217
|
|
|
218
|
+
DOC_STRING(
|
|
219
|
+
"When using @.UseFastRefresh, @.UseLiveReload, or @.UseWebDebugger this controls whether the bundler should include inline source maps."
|
|
220
|
+
"If set, the bundler will include the source maps inline (this will improve debugging experience, but for very large bundles it could have a significant performance hit)")
|
|
221
|
+
DOC_DEFAULT("true")
|
|
222
|
+
Boolean RequestInlineSourceMap { get; set; };
|
|
223
|
+
|
|
218
224
|
DOC_STRING(
|
|
219
225
|
"The @JSIEngine override to be used with the React instance.\n"
|
|
220
226
|
"In order for the override to work, Microsoft.ReactNative must be compiled with support of that engine. "
|
|
@@ -132,6 +132,7 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
|
|
|
132
132
|
}
|
|
133
133
|
reactOptions.DeveloperSettings.SourceBundleHost = to_string(m_instanceSettings.SourceBundleHost());
|
|
134
134
|
reactOptions.DeveloperSettings.SourceBundlePort = m_instanceSettings.SourceBundlePort();
|
|
135
|
+
reactOptions.DeveloperSettings.RequestInlineSourceMap = m_instanceSettings.RequestInlineSourceMap();
|
|
135
136
|
|
|
136
137
|
reactOptions.ByteCodeFileUri = to_string(m_instanceSettings.ByteCodeFileUri());
|
|
137
138
|
reactOptions.EnableByteCodeCaching = m_instanceSettings.EnableByteCodeCaching();
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#include "pch.h"
|
|
8
8
|
#include "TurboModulesProvider.h"
|
|
9
9
|
#include <ReactCommon/TurboModuleUtils.h>
|
|
10
|
+
#include "JSDispatcherWriter.h"
|
|
10
11
|
#include "JsiApi.h"
|
|
11
12
|
#include "JsiReader.h"
|
|
12
13
|
#include "JsiWriter.h"
|
|
@@ -58,7 +59,7 @@ struct TurboModuleBuilder : winrt::implements<TurboModuleBuilder, IReactModuleBu
|
|
|
58
59
|
std::unordered_map<std::string, TurboModuleMethodInfo> m_methods;
|
|
59
60
|
std::unordered_map<std::string, SyncMethodDelegate> m_syncMethods;
|
|
60
61
|
std::vector<ConstantProviderDelegate> m_constantProviders;
|
|
61
|
-
bool m_constantsEvaluated
|
|
62
|
+
bool m_constantsEvaluated{false};
|
|
62
63
|
|
|
63
64
|
private:
|
|
64
65
|
void EnsureMemberNotSet(const std::string &key, bool checkingMethod) noexcept {
|
|
@@ -82,11 +83,13 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
82
83
|
TurboModuleImpl(
|
|
83
84
|
const IReactContext &reactContext,
|
|
84
85
|
const std::string &name,
|
|
85
|
-
std::shared_ptr<facebook::react::CallInvoker> jsInvoker,
|
|
86
|
-
ReactModuleProvider reactModuleProvider)
|
|
87
|
-
: facebook::react::TurboModule(name, jsInvoker),
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker,
|
|
87
|
+
const ReactModuleProvider &reactModuleProvider)
|
|
88
|
+
: facebook::react::TurboModule(name, jsInvoker),
|
|
89
|
+
m_reactContext(reactContext),
|
|
90
|
+
m_moduleBuilder(winrt::make<TurboModuleBuilder>(reactContext)),
|
|
91
|
+
m_providedModule(reactModuleProvider(m_moduleBuilder)) {
|
|
92
|
+
if (auto hostObject = m_providedModule.try_as<IJsiHostObject>()) {
|
|
90
93
|
m_hostObjectWrapper = std::make_shared<implementation::HostObjectWrapper>(hostObject);
|
|
91
94
|
}
|
|
92
95
|
}
|
|
@@ -96,12 +99,13 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
96
99
|
return m_hostObjectWrapper->getPropertyNames(rt);
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
auto turboModuleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
|
|
103
|
+
std::vector<facebook::jsi::PropNameID> propertyNames;
|
|
104
|
+
propertyNames.reserve(turboModuleBuilder->m_methods.size());
|
|
105
|
+
for (auto &methodInfo : turboModuleBuilder->m_methods) {
|
|
106
|
+
propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, methodInfo.first));
|
|
103
107
|
}
|
|
104
|
-
return
|
|
108
|
+
return propertyNames;
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
facebook::jsi::Value get(facebook::jsi::Runtime &runtime, const facebook::jsi::PropNameID &propName) override {
|
|
@@ -110,25 +114,25 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
// it is not safe to assume that "runtime" never changes, so members are not cached here
|
|
113
|
-
auto
|
|
114
|
-
|
|
117
|
+
auto moduleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
|
|
118
|
+
std::string key = propName.utf8(runtime);
|
|
115
119
|
|
|
116
|
-
if (key == "getConstants" &&
|
|
120
|
+
if (key == "getConstants" && !moduleBuilder->m_constantProviders.empty()) {
|
|
117
121
|
// try to find getConstants if there is any constant
|
|
118
122
|
return facebook::jsi::Function::createFromHostFunction(
|
|
119
123
|
runtime,
|
|
120
124
|
propName,
|
|
121
125
|
0,
|
|
122
|
-
[
|
|
126
|
+
[moduleBuilder](
|
|
123
127
|
facebook::jsi::Runtime &rt,
|
|
124
128
|
const facebook::jsi::Value &thisVal,
|
|
125
129
|
const facebook::jsi::Value *args,
|
|
126
130
|
size_t count) {
|
|
127
131
|
// collect all constants to an object
|
|
128
|
-
auto writer = winrt::make<JsiWriter>(
|
|
132
|
+
auto writer = winrt::make<JsiWriter>(rt);
|
|
129
133
|
writer.WriteObjectBegin();
|
|
130
|
-
for (auto
|
|
131
|
-
|
|
134
|
+
for (auto constantProvider : moduleBuilder->m_constantProviders) {
|
|
135
|
+
constantProvider(writer);
|
|
132
136
|
}
|
|
133
137
|
writer.WriteObjectEnd();
|
|
134
138
|
return writer.as<JsiWriter>()->MoveResult();
|
|
@@ -137,150 +141,134 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
137
141
|
|
|
138
142
|
{
|
|
139
143
|
// try to find a Method
|
|
140
|
-
auto it =
|
|
141
|
-
if (it !=
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
144
|
+
auto it = moduleBuilder->m_methods.find(key);
|
|
145
|
+
if (it != moduleBuilder->m_methods.end()) {
|
|
146
|
+
TurboModuleMethodInfo methodInfo = it->second;
|
|
147
|
+
switch (methodInfo.ReturnType) {
|
|
148
|
+
case MethodReturnType::Void:
|
|
149
|
+
return facebook::jsi::Function::createFromHostFunction(
|
|
150
|
+
runtime,
|
|
151
|
+
propName,
|
|
152
|
+
0,
|
|
153
|
+
[methodInfo](
|
|
154
|
+
facebook::jsi::Runtime &rt,
|
|
155
|
+
const facebook::jsi::Value & /*thisVal*/,
|
|
156
|
+
const facebook::jsi::Value *args,
|
|
157
|
+
size_t argCount) {
|
|
158
|
+
methodInfo.Method(winrt::make<JsiReader>(rt, args, argCount), nullptr, nullptr, nullptr);
|
|
159
|
+
return facebook::jsi::Value::undefined();
|
|
160
|
+
});
|
|
161
|
+
case MethodReturnType::Callback:
|
|
162
|
+
return facebook::jsi::Function::createFromHostFunction(
|
|
163
|
+
runtime,
|
|
164
|
+
propName,
|
|
165
|
+
0,
|
|
166
|
+
[jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
|
|
167
|
+
facebook::jsi::Runtime &rt,
|
|
168
|
+
const facebook::jsi::Value & /*thisVal*/,
|
|
169
|
+
const facebook::jsi::Value *args,
|
|
170
|
+
size_t argCount) {
|
|
171
|
+
VerifyElseCrash(argCount > 0);
|
|
172
|
+
methodInfo.Method(
|
|
173
|
+
winrt::make<JsiReader>(rt, args, argCount - 1),
|
|
174
|
+
winrt::make<JSDispatcherWriter>(jsDispatcher, rt),
|
|
175
|
+
MakeCallback(rt, {rt, args[argCount - 1]}),
|
|
176
|
+
nullptr);
|
|
177
|
+
return facebook::jsi::Value::undefined();
|
|
178
|
+
});
|
|
179
|
+
case MethodReturnType::TwoCallbacks:
|
|
180
|
+
return facebook::jsi::Function::createFromHostFunction(
|
|
181
|
+
runtime,
|
|
182
|
+
propName,
|
|
183
|
+
0,
|
|
184
|
+
[jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
|
|
185
|
+
facebook::jsi::Runtime &rt,
|
|
186
|
+
const facebook::jsi::Value & /*thisVal*/,
|
|
187
|
+
const facebook::jsi::Value *args,
|
|
188
|
+
size_t argCount) {
|
|
189
|
+
VerifyElseCrash(argCount > 1);
|
|
190
|
+
methodInfo.Method(
|
|
191
|
+
winrt::make<JsiReader>(rt, args, argCount - 2),
|
|
192
|
+
winrt::make<JSDispatcherWriter>(jsDispatcher, rt),
|
|
193
|
+
MakeCallback(rt, {rt, args[argCount - 2]}),
|
|
194
|
+
MakeCallback(rt, {rt, args[argCount - 1]}));
|
|
180
195
|
return facebook::jsi::Value::undefined();
|
|
181
|
-
}
|
|
182
|
-
|
|
196
|
+
});
|
|
197
|
+
case MethodReturnType::Promise:
|
|
198
|
+
return facebook::jsi::Function::createFromHostFunction(
|
|
199
|
+
runtime,
|
|
200
|
+
propName,
|
|
201
|
+
0,
|
|
202
|
+
[jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
|
|
203
|
+
facebook::jsi::Runtime &rt,
|
|
204
|
+
const facebook::jsi::Value & /*thisVal*/,
|
|
205
|
+
const facebook::jsi::Value *args,
|
|
206
|
+
size_t count) {
|
|
207
|
+
auto argReader = winrt::make<JsiReader>(rt, args, count);
|
|
208
|
+
auto argWriter = winrt::make<JSDispatcherWriter>(jsDispatcher, rt);
|
|
183
209
|
return facebook::react::createPromiseAsJSIValue(
|
|
184
|
-
|
|
185
|
-
|
|
210
|
+
rt,
|
|
211
|
+
[methodInfo, argReader, argWriter](
|
|
212
|
+
facebook::jsi::Runtime &runtime, std::shared_ptr<facebook::react::Promise> promise) {
|
|
213
|
+
methodInfo.Method(
|
|
186
214
|
argReader,
|
|
187
215
|
argWriter,
|
|
188
|
-
[promise
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
promise->resolve(resultItem);
|
|
197
|
-
} else {
|
|
198
|
-
VerifyElseCrash(false);
|
|
199
|
-
}
|
|
216
|
+
[promise](const IJSValueWriter &writer) {
|
|
217
|
+
writer.as<JSDispatcherWriter>()->WithResultArgs([promise](
|
|
218
|
+
facebook::jsi::Runtime &runtime,
|
|
219
|
+
facebook::jsi::Value const *args,
|
|
220
|
+
size_t argCount) {
|
|
221
|
+
VerifyElseCrash(argCount == 1);
|
|
222
|
+
promise->resolve(args[0]);
|
|
223
|
+
});
|
|
200
224
|
},
|
|
201
|
-
[promise
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
auto
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
[promise](const IJSValueWriter &writer) {
|
|
226
|
+
writer.as<JSDispatcherWriter>()->WithResultArgs([promise](
|
|
227
|
+
facebook::jsi::Runtime &runtime,
|
|
228
|
+
facebook::jsi::Value const *args,
|
|
229
|
+
size_t argCount) {
|
|
230
|
+
VerifyElseCrash(argCount == 1);
|
|
231
|
+
// To match the Android and iOS TurboModule behavior we create the Error object for
|
|
232
|
+
// the Promise rejection the same way as in updateErrorWithErrorData method.
|
|
233
|
+
// See react-native/Libraries/BatchedBridge/NativeModules.js for details.
|
|
234
|
+
auto error = runtime.global()
|
|
235
|
+
.getPropertyAsFunction(runtime, "Error")
|
|
236
|
+
.callAsConstructor(runtime, {});
|
|
237
|
+
auto &errorData = args[0];
|
|
238
|
+
if (errorData.isObject()) {
|
|
239
|
+
runtime.global()
|
|
240
|
+
.getPropertyAsObject(runtime, "Object")
|
|
241
|
+
.getPropertyAsFunction(runtime, "assign")
|
|
242
|
+
.call(runtime, error, errorData.getObject(runtime));
|
|
243
|
+
}
|
|
244
|
+
promise->reject_.call(runtime, error);
|
|
245
|
+
});
|
|
220
246
|
});
|
|
221
247
|
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
facebook::jsi::Value rejectFunction;
|
|
227
|
-
if (method.ReturnType == MethodReturnType::Callback) {
|
|
228
|
-
resolveFunction = {runtime, args[count - 1]};
|
|
229
|
-
} else {
|
|
230
|
-
resolveFunction = {runtime, args[count - 2]};
|
|
231
|
-
rejectFunction = {runtime, args[count - 1]};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
auto makeCallback =
|
|
235
|
-
[&runtime](const facebook::jsi::Value &callbackValue) noexcept -> MethodResultCallback {
|
|
236
|
-
// workaround: xcode doesn't accept a captured value with only rvalue copy constructor
|
|
237
|
-
auto functionObject =
|
|
238
|
-
std::make_shared<facebook::jsi::Function>(callbackValue.asObject(runtime).asFunction(runtime));
|
|
239
|
-
return [&runtime, callbackFunction = functionObject](const IJSValueWriter &writer) noexcept {
|
|
240
|
-
const facebook::jsi::Value *resultArgs = nullptr;
|
|
241
|
-
size_t resultCount = 0;
|
|
242
|
-
writer.as<JsiWriter>()->AccessResultAsArgs(resultArgs, resultCount);
|
|
243
|
-
callbackFunction->call(runtime, resultArgs, resultCount);
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
method.Method(
|
|
248
|
-
argReader,
|
|
249
|
-
argWriter,
|
|
250
|
-
makeCallback(resolveFunction),
|
|
251
|
-
(method.ReturnType == MethodReturnType::Callback ? nullptr : makeCallback(rejectFunction)));
|
|
252
|
-
return facebook::jsi::Value::undefined();
|
|
253
|
-
}
|
|
254
|
-
default:
|
|
255
|
-
VerifyElseCrash(false);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
248
|
+
});
|
|
249
|
+
default:
|
|
250
|
+
VerifyElseCrash(false);
|
|
251
|
+
}
|
|
258
252
|
}
|
|
259
253
|
}
|
|
260
254
|
|
|
261
255
|
{
|
|
262
256
|
// try to find a SyncMethod
|
|
263
|
-
auto it =
|
|
264
|
-
if (it !=
|
|
257
|
+
auto it = moduleBuilder->m_syncMethods.find(key);
|
|
258
|
+
if (it != moduleBuilder->m_syncMethods.end()) {
|
|
265
259
|
return facebook::jsi::Function::createFromHostFunction(
|
|
266
260
|
runtime,
|
|
267
261
|
propName,
|
|
268
262
|
0,
|
|
269
|
-
[
|
|
263
|
+
[method = it->second](
|
|
270
264
|
facebook::jsi::Runtime &rt,
|
|
271
265
|
const facebook::jsi::Value &thisVal,
|
|
272
266
|
const facebook::jsi::Value *args,
|
|
273
267
|
size_t count) {
|
|
274
|
-
|
|
275
|
-
auto
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
auto writer = winrt::make<JsiWriter>(runtime);
|
|
279
|
-
|
|
280
|
-
// call the function
|
|
281
|
-
method(argReader, writer);
|
|
282
|
-
|
|
283
|
-
return writer.as<JsiWriter>()->MoveResult();
|
|
268
|
+
auto argReader = winrt::make<JsiReader>(rt, args, count);
|
|
269
|
+
auto argWriter = winrt::make<JsiWriter>(rt);
|
|
270
|
+
method(argReader, argWriter);
|
|
271
|
+
return argWriter.as<JsiWriter>()->MoveResult();
|
|
284
272
|
});
|
|
285
273
|
}
|
|
286
274
|
}
|
|
@@ -299,17 +287,30 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
299
287
|
}
|
|
300
288
|
|
|
301
289
|
private:
|
|
290
|
+
static MethodResultCallback MakeCallback(facebook::jsi::Runtime &runtime, facebook::jsi::Value callback) noexcept {
|
|
291
|
+
auto sharedCallback =
|
|
292
|
+
std::make_shared<facebook::jsi::Function>(std::move(callback).asObject(runtime).asFunction(runtime));
|
|
293
|
+
return [sharedCallback = std::move(sharedCallback)](const IJSValueWriter &writer) noexcept {
|
|
294
|
+
writer.as<JSDispatcherWriter>()->WithResultArgs(
|
|
295
|
+
[sharedCallback](facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t count) {
|
|
296
|
+
sharedCallback->call(rt, args, count);
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private:
|
|
302
|
+
IReactContext m_reactContext;
|
|
302
303
|
IReactModuleBuilder m_moduleBuilder;
|
|
303
|
-
IInspectable
|
|
304
|
+
IInspectable m_providedModule;
|
|
304
305
|
std::shared_ptr<implementation::HostObjectWrapper> m_hostObjectWrapper;
|
|
305
306
|
};
|
|
306
307
|
|
|
307
308
|
/*-------------------------------------------------------------------------------
|
|
308
309
|
TurboModulesProvider
|
|
309
310
|
-------------------------------------------------------------------------------*/
|
|
310
|
-
|
|
311
|
+
std::shared_ptr<facebook::react::TurboModule> TurboModulesProvider::getModule(
|
|
311
312
|
const std::string &moduleName,
|
|
312
|
-
const
|
|
313
|
+
const std::shared_ptr<facebook::react::CallInvoker> &callInvoker) noexcept {
|
|
313
314
|
// fail if the expected turbo module has not been registered
|
|
314
315
|
auto it = m_moduleProviders.find(moduleName);
|
|
315
316
|
if (it == m_moduleProviders.end()) {
|
|
@@ -13,16 +13,11 @@
|
|
|
13
13
|
namespace winrt::Microsoft::ReactNative {
|
|
14
14
|
|
|
15
15
|
class TurboModulesProvider final : public facebook::react::TurboModuleRegistry {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
using CallInvokerPtr = std::shared_ptr<CallInvoker>;
|
|
22
|
-
|
|
23
|
-
public:
|
|
24
|
-
virtual TurboModulePtr getModule(const std::string &moduleName, const CallInvokerPtr &callInvoker) noexcept override;
|
|
25
|
-
virtual std::vector<std::string> getEagerInitModuleNames() noexcept override;
|
|
16
|
+
public: // TurboModuleRegistry implementation
|
|
17
|
+
std::shared_ptr<facebook::react::TurboModule> getModule(
|
|
18
|
+
const std::string &moduleName,
|
|
19
|
+
const std::shared_ptr<facebook::react::CallInvoker> &callInvoker) noexcept override;
|
|
20
|
+
std::vector<std::string> getEagerInitModuleNames() noexcept override;
|
|
26
21
|
|
|
27
22
|
public:
|
|
28
23
|
void SetReactContext(const IReactContext &reactContext) noexcept;
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.67.
|
|
13
|
+
<ReactNativeWindowsVersion>0.67.3</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>67</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>3</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
18
|
</PropertyGroup>
|
|
19
19
|
</Project>
|
|
@@ -46,6 +46,10 @@ std::map<std::string, folly::dynamic> PlatformConstantsModule::getConstants() {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/*static*/ int32_t PlatformConstantsModule::OsVersion() noexcept {
|
|
49
|
+
if (!IsWindows10OrGreater()) {
|
|
50
|
+
return -1;
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
for (uint16_t i = 1;; ++i) {
|
|
50
54
|
if (!ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", i)) {
|
|
51
55
|
return i - 1;
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -372,7 +372,6 @@ InstanceImpl::InstanceImpl(
|
|
|
372
372
|
switch (m_devSettings->jsiEngineOverride) {
|
|
373
373
|
case JSIEngineOverride::Hermes:
|
|
374
374
|
m_devSettings->jsiRuntimeHolder = std::make_shared<HermesRuntimeHolder>(m_devSettings, m_jsThread);
|
|
375
|
-
m_devSettings->inlineSourceMap = false;
|
|
376
375
|
break;
|
|
377
376
|
case JSIEngineOverride::V8: {
|
|
378
377
|
#if defined(USE_V8)
|