react-native-windows 0.69.0-preview.3 → 0.69.0-preview.4
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/Directory.Build.props +4 -0
- package/Folly/Folly.vcxproj +4 -5
- package/Libraries/Network/RCTNetworkingWinShared.js +7 -0
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +3 -1
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +2 -0
- package/Microsoft.ReactNative/IReactContext.idl +27 -0
- package/Microsoft.ReactNative/JsiApi.cpp +9 -0
- package/Microsoft.ReactNative/JsiApi.h +1 -0
- package/Microsoft.ReactNative/JsiApi.idl +1 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +3 -5
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +31 -9
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +48 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +1 -1
- package/Microsoft.ReactNative.Managed/packages.lock.json +57 -2
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/PropertySheets/JSEngine.props +2 -2
- package/Shared/CreateModules.h +17 -2
- package/Shared/InspectorPackagerConnection.cpp +6 -7
- package/Shared/InspectorPackagerConnection.h +1 -1
- package/Shared/JSI/ChakraRuntime.cpp +5 -0
- package/Shared/JSI/ChakraRuntime.h +1 -0
- package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +72 -2
- package/Shared/JSI/NapiJsiV8RuntimeHolder.h +2 -0
- package/Shared/Modules/BlobModule.cpp +376 -0
- package/Shared/Modules/BlobModule.h +153 -0
- package/Shared/Modules/CxxModuleUtilities.cpp +19 -0
- package/Shared/Modules/CxxModuleUtilities.h +23 -0
- package/Shared/Modules/FileReaderModule.cpp +156 -0
- package/Shared/Modules/FileReaderModule.h +54 -0
- package/Shared/Modules/HttpModule.cpp +72 -69
- package/Shared/Modules/HttpModule.h +8 -1
- package/Shared/Modules/IBlobPersistor.h +30 -0
- package/Shared/Modules/IHttpModuleProxy.h +30 -0
- package/Shared/Modules/IRequestBodyHandler.h +52 -0
- package/Shared/Modules/IResponseHandler.h +27 -0
- package/Shared/Modules/IUriHandler.h +37 -0
- package/Shared/Modules/IWebSocketModuleContentHandler.h +26 -0
- package/Shared/Modules/IWebSocketModuleProxy.h +22 -0
- package/Shared/Modules/NetworkingModule.cpp +1 -1
- package/Shared/Modules/WebSocketModule.cpp +92 -22
- package/Shared/Modules/WebSocketModule.h +27 -1
- package/Shared/Networking/IHttpResource.h +50 -2
- package/Shared/Networking/WinRTHttpResource.cpp +169 -51
- package/Shared/Networking/WinRTHttpResource.h +27 -8
- package/Shared/Networking/WinRTTypes.h +5 -2
- package/Shared/OInstance.cpp +22 -5
- package/Shared/OInstance.h +8 -4
- package/Shared/RuntimeOptions.cpp +6 -3
- package/Shared/RuntimeOptions.h +14 -3
- package/Shared/Shared.vcxitems +13 -0
- package/Shared/Shared.vcxitems.filters +40 -1
- package/fmt/fmt.vcxproj +4 -5
- package/package.json +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/JSCRuntime.cpp +0 -1480
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/decorator.h +0 -753
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/jsi.h +0 -1331
package/Directory.Build.props
CHANGED
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
The PR (windows-vs-pr.yml) and CI (publish.yml() turn it back on.
|
|
16
16
|
-->
|
|
17
17
|
<EnableSourceLink Condition="'$(EnableSourceLink)' == ''">false</EnableSourceLink>
|
|
18
|
+
<!-- When bumping the Folly version, be sure to bump the git hash of that version's commit too. -->
|
|
18
19
|
<FollyVersion>2021.06.28.00</FollyVersion>
|
|
20
|
+
<FollyCommitHash>f434460f8a98e85f3ddb75390ddd1cc330c8f658</FollyCommitHash>
|
|
21
|
+
<!-- When bumping the fmt version, be sure to bump the git hash of that version's commit too. -->
|
|
19
22
|
<FmtVersion>7.1.3</FmtVersion>
|
|
23
|
+
<FmtCommitHash>7bdf0628b1276379886c7f6dda2cef2b3b374f0b</FmtCommitHash>
|
|
20
24
|
</PropertyGroup>
|
|
21
25
|
|
|
22
26
|
<PropertyGroup Label="Configuration">
|
package/Folly/Folly.vcxproj
CHANGED
|
@@ -289,11 +289,10 @@
|
|
|
289
289
|
"Registrations": [
|
|
290
290
|
{
|
|
291
291
|
"Component": {
|
|
292
|
-
"Type": "
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
296
|
-
"DownloadUrl": "https://github.com/facebook/folly/archive/v$(FollyVersion).zip"
|
|
292
|
+
"Type": "git",
|
|
293
|
+
"Git": {
|
|
294
|
+
"RepositoryUrl": "https://github.com/facebook/folly",
|
|
295
|
+
"CommitHash": "$(FollyCommitHash)"
|
|
297
296
|
}
|
|
298
297
|
},
|
|
299
298
|
"DevelopmentDependency": false
|
|
@@ -61,6 +61,11 @@ type RCTNetworkingEventDefinitions = $ReadOnly<{
|
|
|
61
61
|
],
|
|
62
62
|
}>;
|
|
63
63
|
|
|
64
|
+
let _requestId = 1;
|
|
65
|
+
function generateRequestId(): number {
|
|
66
|
+
return _requestId++;
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
const RCTNetworking = {
|
|
65
70
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
66
71
|
eventType: K,
|
|
@@ -82,11 +87,13 @@ const RCTNetworking = {
|
|
|
82
87
|
callback: (requestId: number) => void,
|
|
83
88
|
withCredentials: boolean,
|
|
84
89
|
) {
|
|
90
|
+
const requestId = generateRequestId();
|
|
85
91
|
const body = convertRequestBody(data);
|
|
86
92
|
RCTNetworkingNative.sendRequest(
|
|
87
93
|
{
|
|
88
94
|
method,
|
|
89
95
|
url,
|
|
96
|
+
requestId,
|
|
90
97
|
data: {...body, trackingName},
|
|
91
98
|
headers,
|
|
92
99
|
responseType,
|
|
@@ -46,7 +46,9 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
|
|
|
46
46
|
std::vector<facebook::react::NativeModuleDescription> modules;
|
|
47
47
|
|
|
48
48
|
modules.emplace_back(
|
|
49
|
-
"Networking",
|
|
49
|
+
"Networking",
|
|
50
|
+
[props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
|
|
51
|
+
jsMessageQueue);
|
|
50
52
|
|
|
51
53
|
modules.emplace_back(
|
|
52
54
|
"Timing",
|
|
@@ -96,6 +96,23 @@ Windows::Foundation::IInspectable ReactContext::JSRuntime() noexcept {
|
|
|
96
96
|
return m_context->JsiRuntime();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
LoadingState ReactContext::LoadingState() noexcept {
|
|
100
|
+
switch (m_context->State()) {
|
|
101
|
+
case Mso::React::ReactInstanceState::Loading:
|
|
102
|
+
case Mso::React::ReactInstanceState::WaitingForDebugger:
|
|
103
|
+
return LoadingState::Loading;
|
|
104
|
+
case Mso::React::ReactInstanceState::Loaded:
|
|
105
|
+
return LoadingState::Loaded;
|
|
106
|
+
case Mso::React::ReactInstanceState::HasError:
|
|
107
|
+
return LoadingState::HasError;
|
|
108
|
+
case Mso::React::ReactInstanceState::Unloaded:
|
|
109
|
+
return LoadingState::Unloaded;
|
|
110
|
+
default:
|
|
111
|
+
assert(false);
|
|
112
|
+
return LoadingState::HasError;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
#ifndef CORE_ABI
|
|
100
117
|
// Deprecated: Use XamlUIService directly.
|
|
101
118
|
void ReactContext::DispatchEvent(
|
|
@@ -42,6 +42,8 @@ struct ReactContext : winrt::implements<ReactContext, IReactContext> {
|
|
|
42
42
|
IReactDispatcher UIDispatcher() noexcept;
|
|
43
43
|
IReactDispatcher JSDispatcher() noexcept;
|
|
44
44
|
IInspectable JSRuntime() noexcept;
|
|
45
|
+
LoadingState LoadingState() noexcept;
|
|
46
|
+
|
|
45
47
|
#ifndef CORE_ABI
|
|
46
48
|
void DispatchEvent(
|
|
47
49
|
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
|
|
@@ -167,5 +190,9 @@ namespace Microsoft.ReactNative
|
|
|
167
190
|
"The `paramsArgWriter` is a @JSValueArgWriter delegate that receives @IJSValueWriter to serialize "
|
|
168
191
|
"the event parameters.")
|
|
169
192
|
void EmitJSEvent(String eventEmitterName, String eventName, JSValueArgWriter paramsArgWriter);
|
|
193
|
+
|
|
194
|
+
DOC_STRING(
|
|
195
|
+
"Gets the state of the ReactNative instance.")
|
|
196
|
+
LoadingState LoadingState { get; };
|
|
170
197
|
}
|
|
171
198
|
} // namespace Microsoft.ReactNative
|
|
@@ -143,6 +143,7 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
143
143
|
using facebook::jsi::Runtime::createObject;
|
|
144
144
|
using facebook::jsi::Runtime::createPropNameIDFromAscii;
|
|
145
145
|
using facebook::jsi::Runtime::createPropNameIDFromString;
|
|
146
|
+
using facebook::jsi::Runtime::createPropNameIDFromSymbol;
|
|
146
147
|
using facebook::jsi::Runtime::createPropNameIDFromUtf8;
|
|
147
148
|
using facebook::jsi::Runtime::createStringFromUtf8;
|
|
148
149
|
using facebook::jsi::Runtime::createValueFromJsonUtf8;
|
|
@@ -572,6 +573,14 @@ JsiPropertyIdRef JsiRuntime::CreatePropertyIdFromString(JsiStringRef str) try {
|
|
|
572
573
|
throw;
|
|
573
574
|
}
|
|
574
575
|
|
|
576
|
+
JsiPropertyIdRef JsiRuntime::CreatePropertyIdFromSymbol(JsiSymbolRef sym) try {
|
|
577
|
+
auto symPtr = RuntimeAccessor::AsPointerValue(sym);
|
|
578
|
+
return PointerAccessor::MakeJsiPropertyNameIdData(
|
|
579
|
+
m_runtimeAccessor->createPropNameIDFromSymbol(RuntimeAccessor::AsSymbol(&symPtr)));
|
|
580
|
+
} catch (JSI_SET_ERROR) {
|
|
581
|
+
throw;
|
|
582
|
+
}
|
|
583
|
+
|
|
575
584
|
hstring JsiRuntime::PropertyIdToString(JsiPropertyIdRef propertyId) try {
|
|
576
585
|
auto ptr = RuntimeAccessor::AsPointerValue(propertyId);
|
|
577
586
|
std::string utf8 = m_runtimeAccessor->utf8(RuntimeAccessor::AsPropNameID(&ptr));
|
|
@@ -90,6 +90,7 @@ struct JsiRuntime : JsiRuntimeT<JsiRuntime> {
|
|
|
90
90
|
JsiPropertyIdRef CreatePropertyIdFromAscii(array_view<uint8_t const> ascii);
|
|
91
91
|
JsiPropertyIdRef CreatePropertyIdFromUtf8(array_view<uint8_t const> utf8);
|
|
92
92
|
JsiPropertyIdRef CreatePropertyIdFromString(JsiStringRef str);
|
|
93
|
+
JsiPropertyIdRef CreatePropertyIdFromSymbol(JsiSymbolRef sym);
|
|
93
94
|
hstring PropertyIdToString(JsiPropertyIdRef propertyId);
|
|
94
95
|
void PropertyIdToUtf8(JsiPropertyIdRef propertyId, JsiByteArrayUser const &useUtf8String);
|
|
95
96
|
bool PropertyIdEquals(JsiPropertyIdRef left, JsiPropertyIdRef right);
|
|
@@ -246,6 +246,7 @@ namespace Microsoft.ReactNative
|
|
|
246
246
|
JsiPropertyIdRef CreatePropertyIdFromAscii(UInt8[] ascii);
|
|
247
247
|
JsiPropertyIdRef CreatePropertyIdFromUtf8(UInt8[] utf8);
|
|
248
248
|
JsiPropertyIdRef CreatePropertyIdFromString(JsiStringRef str);
|
|
249
|
+
JsiPropertyIdRef CreatePropertyIdFromSymbol(JsiSymbolRef sym);
|
|
249
250
|
String PropertyIdToString(JsiPropertyIdRef propertyId);
|
|
250
251
|
void PropertyIdToUtf8(JsiPropertyIdRef propertyId, JsiByteArrayUser useUtf8String);
|
|
251
252
|
Boolean PropertyIdEquals(JsiPropertyIdRef left, JsiPropertyIdRef right);
|
|
@@ -306,11 +306,9 @@ PropNameID JsiAbiRuntime::createPropNameIDFromString(const String &str) try {
|
|
|
306
306
|
throw;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
PropNameID JsiAbiRuntime::createPropNameIDFromSymbol(const Symbol &sym) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// symbol property through the C++ API.
|
|
313
|
-
UNREFERENCED_PARAMETER(sym);
|
|
309
|
+
PropNameID JsiAbiRuntime::createPropNameIDFromSymbol(const Symbol &sym) try {
|
|
310
|
+
return MakePropNameID(m_runtime.CreatePropertyIdFromSymbol(AsJsiSymbolRef(sym)));
|
|
311
|
+
} catch (hresult_error const &) {
|
|
314
312
|
RethrowJsiError();
|
|
315
313
|
throw;
|
|
316
314
|
}
|
|
@@ -99,7 +99,7 @@ struct JsiAbiRuntime : facebook::jsi::Runtime {
|
|
|
99
99
|
facebook::jsi::PropNameID createPropNameIDFromAscii(const char *str, size_t length) override;
|
|
100
100
|
facebook::jsi::PropNameID createPropNameIDFromUtf8(const uint8_t *utf8, size_t length) override;
|
|
101
101
|
facebook::jsi::PropNameID createPropNameIDFromString(const facebook::jsi::String &str) override;
|
|
102
|
-
facebook::jsi::PropNameID createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym);
|
|
102
|
+
facebook::jsi::PropNameID createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym) override;
|
|
103
103
|
std::string utf8(const facebook::jsi::PropNameID &propertyNameId) override;
|
|
104
104
|
bool compare(const facebook::jsi::PropNameID &left, const facebook::jsi::PropNameID &right) override;
|
|
105
105
|
|
|
@@ -137,7 +137,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
|
|
|
137
137
|
facebook::jsi::PropNameID createPropNameIDFromAscii(const char *str, size_t length) override;
|
|
138
138
|
facebook::jsi::PropNameID createPropNameIDFromUtf8(const uint8_t *utf8, size_t length) override;
|
|
139
139
|
facebook::jsi::PropNameID createPropNameIDFromString(const facebook::jsi::String &str) override;
|
|
140
|
-
facebook::jsi::PropNameID createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym);
|
|
140
|
+
facebook::jsi::PropNameID createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym) override;
|
|
141
141
|
std::string utf8(const facebook::jsi::PropNameID &id) override;
|
|
142
142
|
bool compare(const facebook::jsi::PropNameID &lhs, const facebook::jsi::PropNameID &rhs) override;
|
|
143
143
|
|
|
@@ -441,6 +441,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
|
|
|
441
441
|
|
|
442
442
|
private: // Shared NAPI call helpers
|
|
443
443
|
napi_value RunScript(napi_value script, const char *sourceUrl);
|
|
444
|
+
napi_value RunScriptBuffer(const std::shared_ptr<const facebook::jsi::Buffer> &buffer, const char *sourceUrl);
|
|
444
445
|
std::vector<uint8_t> SerializeScript(napi_value script, const char *sourceUrl);
|
|
445
446
|
napi_value RunSerializedScript(span<const uint8_t> serialized, napi_value source, const char *sourceUrl);
|
|
446
447
|
napi_ext_ref CreateReference(napi_value value) const;
|
|
@@ -463,6 +464,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
|
|
|
463
464
|
napi_ext_ref GetPropertyIdFromName(std::string_view value) const;
|
|
464
465
|
napi_ext_ref GetPropertyIdFromName(const uint8_t *data, size_t length) const;
|
|
465
466
|
napi_ext_ref GetPropertyIdFromName(napi_value str) const;
|
|
467
|
+
napi_ext_ref GetPropertyIdFromSymbol(napi_value sym) const;
|
|
466
468
|
std::string PropertyIdToStdString(napi_value propertyId);
|
|
467
469
|
napi_value CreateSymbol(std::string_view symbolDescription) const;
|
|
468
470
|
std::string SymbolToStdString(napi_value symbolValue);
|
|
@@ -621,9 +623,7 @@ NapiJsiRuntime::NapiJsiRuntime(napi_env env) noexcept : m_env{env} {
|
|
|
621
623
|
|
|
622
624
|
Value NapiJsiRuntime::evaluateJavaScript(const shared_ptr<const Buffer> &buffer, const string &sourceUrl) {
|
|
623
625
|
EnvScope envScope{m_env};
|
|
624
|
-
napi_value
|
|
625
|
-
napi_value result = RunScript(script, sourceUrl.c_str());
|
|
626
|
-
|
|
626
|
+
napi_value result = RunScriptBuffer(buffer, sourceUrl.c_str());
|
|
627
627
|
return ToJsiValue(result);
|
|
628
628
|
}
|
|
629
629
|
|
|
@@ -713,11 +713,10 @@ PropNameID NapiJsiRuntime::createPropNameIDFromString(const String &str) {
|
|
|
713
713
|
}
|
|
714
714
|
|
|
715
715
|
PropNameID NapiJsiRuntime::createPropNameIDFromSymbol(const Symbol &sym) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
throw;
|
|
716
|
+
EnvScope envScope{m_env};
|
|
717
|
+
napi_ext_ref propSym = GetPropertyIdFromSymbol(GetNapiValue(sym));
|
|
718
|
+
|
|
719
|
+
return MakePointer<PropNameID>(propSym);
|
|
721
720
|
}
|
|
722
721
|
|
|
723
722
|
string NapiJsiRuntime::utf8(const PropNameID &id) {
|
|
@@ -1415,6 +1414,21 @@ napi_value NapiJsiRuntime::RunScript(napi_value script, const char *sourceUrl) {
|
|
|
1415
1414
|
return result;
|
|
1416
1415
|
}
|
|
1417
1416
|
|
|
1417
|
+
napi_value NapiJsiRuntime::RunScriptBuffer(
|
|
1418
|
+
const std::shared_ptr<const facebook::jsi::Buffer> &buffer,
|
|
1419
|
+
const char *sourceUrl) {
|
|
1420
|
+
napi_ext_buffer napiBuffer{};
|
|
1421
|
+
napiBuffer.buffer_object = NativeObjectWrapper<std::shared_ptr<const facebook::jsi::Buffer>>::Wrap(
|
|
1422
|
+
std::shared_ptr<const facebook::jsi::Buffer>{buffer});
|
|
1423
|
+
napiBuffer.data = buffer->data();
|
|
1424
|
+
napiBuffer.byte_size = buffer->size();
|
|
1425
|
+
|
|
1426
|
+
napi_value result{};
|
|
1427
|
+
CHECK_NAPI(napi_ext_run_script_buffer(m_env, &napiBuffer, sourceUrl, &result));
|
|
1428
|
+
|
|
1429
|
+
return result;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1418
1432
|
// Serializes script with the sourceUrl origin.
|
|
1419
1433
|
vector<uint8_t> NapiJsiRuntime::SerializeScript(napi_value script, const char *sourceUrl) {
|
|
1420
1434
|
vector<uint8_t> result;
|
|
@@ -1600,6 +1614,14 @@ napi_ext_ref NapiJsiRuntime::GetPropertyIdFromName(napi_value str) const {
|
|
|
1600
1614
|
return ref;
|
|
1601
1615
|
}
|
|
1602
1616
|
|
|
1617
|
+
// Gets or creates a unique string value from napi_value string.
|
|
1618
|
+
napi_ext_ref NapiJsiRuntime::GetPropertyIdFromSymbol(napi_value sym) const {
|
|
1619
|
+
napi_ext_ref ref{};
|
|
1620
|
+
CHECK_NAPI(napi_ext_create_reference(m_env, sym, &ref));
|
|
1621
|
+
|
|
1622
|
+
return ref;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1603
1625
|
// Converts property id value to std::string.
|
|
1604
1626
|
string NapiJsiRuntime::PropertyIdToStdString(napi_value propertyId) {
|
|
1605
1627
|
if (TypeOf(propertyId) == napi_symbol) {
|
|
@@ -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
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"Microsoft.SourceLink.Common": "1.0.0"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"boost": {
|
|
28
|
+
"type": "Transitive",
|
|
29
|
+
"resolved": "1.76.0",
|
|
30
|
+
"contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
|
|
31
|
+
},
|
|
27
32
|
"Microsoft.Build.Tasks.Git": {
|
|
28
33
|
"type": "Transitive",
|
|
29
34
|
"resolved": "1.0.0",
|
|
@@ -60,14 +65,34 @@
|
|
|
60
65
|
"resolved": "1.0.0",
|
|
61
66
|
"contentHash": "G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg=="
|
|
62
67
|
},
|
|
68
|
+
"Microsoft.UI.Xaml": {
|
|
69
|
+
"type": "Transitive",
|
|
70
|
+
"resolved": "2.7.0",
|
|
71
|
+
"contentHash": "dB4im13tfmMgL/V3Ei+3kD2rUF+/lTxAmR4gjJ45l577eljHfdo/KUrxpq/3I1Vp6e5GCDG1evDaEGuDxypLMg=="
|
|
72
|
+
},
|
|
73
|
+
"Microsoft.Windows.CppWinRT": {
|
|
74
|
+
"type": "Transitive",
|
|
75
|
+
"resolved": "2.0.211028.7",
|
|
76
|
+
"contentHash": "JBGI0c3WLoU6aYJRy9Qo0MLDQfObEp+d4nrhR95iyzf7+HOgjRunHDp/6eGFREd7xq3OI1mll9ecJrMfzBvlyg=="
|
|
77
|
+
},
|
|
78
|
+
"Microsoft.Windows.SDK.BuildTools": {
|
|
79
|
+
"type": "Transitive",
|
|
80
|
+
"resolved": "10.0.22000.194",
|
|
81
|
+
"contentHash": "4L0P3zqut466SIqT3VBeLTNUQTxCBDOrTRymRuROCRJKazcK7ibLz9yAO1nKWRt50ttCj39oAa2Iuz9ZTDmLlg=="
|
|
82
|
+
},
|
|
63
83
|
"NETStandard.Library": {
|
|
64
84
|
"type": "Transitive",
|
|
65
85
|
"resolved": "2.0.3",
|
|
66
|
-
"contentHash": "
|
|
86
|
+
"contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==",
|
|
67
87
|
"dependencies": {
|
|
68
88
|
"Microsoft.NETCore.Platforms": "1.1.0"
|
|
69
89
|
}
|
|
70
90
|
},
|
|
91
|
+
"ReactNative.Hermes.Windows": {
|
|
92
|
+
"type": "Transitive",
|
|
93
|
+
"resolved": "0.11.0-ms.6",
|
|
94
|
+
"contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg=="
|
|
95
|
+
},
|
|
71
96
|
"runtime.win10-arm.Microsoft.Net.Native.Compiler": {
|
|
72
97
|
"type": "Transitive",
|
|
73
98
|
"resolved": "2.2.7-rel-27913-00",
|
|
@@ -135,8 +160,38 @@
|
|
|
135
160
|
"resolved": "2.2.9",
|
|
136
161
|
"contentHash": "qF6RRZKaflI+LR1YODNyWYjq5YoX8IJ2wx5y8O+AW2xO+1t/Q6Mm+jQ38zJbWnmXbrcOqUYofn7Y3/KC6lTLBQ=="
|
|
137
162
|
},
|
|
138
|
-
"
|
|
163
|
+
"common": {
|
|
139
164
|
"type": "Project"
|
|
165
|
+
},
|
|
166
|
+
"fmt": {
|
|
167
|
+
"type": "Project"
|
|
168
|
+
},
|
|
169
|
+
"folly": {
|
|
170
|
+
"type": "Project",
|
|
171
|
+
"dependencies": {
|
|
172
|
+
"boost": "1.76.0",
|
|
173
|
+
"fmt": "1.0.0"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"microsoft.reactnative": {
|
|
177
|
+
"type": "Project",
|
|
178
|
+
"dependencies": {
|
|
179
|
+
"Common": "1.0.0",
|
|
180
|
+
"Folly": "1.0.0",
|
|
181
|
+
"Microsoft.UI.Xaml": "2.7.0",
|
|
182
|
+
"Microsoft.Windows.CppWinRT": "2.0.211028.7",
|
|
183
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22000.194",
|
|
184
|
+
"ReactCommon": "1.0.0",
|
|
185
|
+
"ReactNative.Hermes.Windows": "0.11.0-ms.6",
|
|
186
|
+
"boost": "1.76.0"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"reactcommon": {
|
|
190
|
+
"type": "Project",
|
|
191
|
+
"dependencies": {
|
|
192
|
+
"Folly": "1.0.0",
|
|
193
|
+
"boost": "1.76.0"
|
|
194
|
+
}
|
|
140
195
|
}
|
|
141
196
|
},
|
|
142
197
|
"UAP,Version=v10.0.16299/win10-arm": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.69.0-preview.
|
|
13
|
+
<ReactNativeWindowsVersion>0.69.0-preview.4</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>69</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
|
|
9
9
|
<UseHermes Condition="'$(UseHermes)' == ''">false</UseHermes>
|
|
10
10
|
<!-- This will be true if (1) the client want to use hermes by setting UseHermes to true OR (2) We are building for UWP where dynamic switching is enabled -->
|
|
11
|
-
<HermesVersion Condition="'$(HermesVersion)' == ''">0.11.0-ms.
|
|
11
|
+
<HermesVersion Condition="'$(HermesVersion)' == ''">0.11.0-ms.6</HermesVersion>
|
|
12
12
|
<HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgReactNative_Hermes_Windows)')">$(PkgReactNative_Hermes_Windows)</HermesPackage>
|
|
13
13
|
<HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\ReactNative.Hermes.Windows\$(HermesVersion)</HermesPackage>
|
|
14
14
|
<EnableHermesInspectorInReleaseFlavor Condition="'$(EnableHermesInspectorInReleaseFlavor)' == ''">false</EnableHermesInspectorInReleaseFlavor>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<EnableDevServerHBCBundles Condition="'$(EnableDevServerHBCBundles)' == ''">false</EnableDevServerHBCBundles>
|
|
19
19
|
|
|
20
20
|
<UseV8 Condition="'$(UseV8)' == ''">false</UseV8>
|
|
21
|
-
<V8Version Condition="'$(V8Version)' == ''">0.
|
|
21
|
+
<V8Version Condition="'$(V8Version)' == ''">0.69.4</V8Version>
|
|
22
22
|
<V8PackageName>ReactNative.V8Jsi.Windows</V8PackageName>
|
|
23
23
|
<V8PackageName Condition="'$(V8AppPlatform)' != 'win32'">$(V8PackageName).UWP</V8PackageName>
|
|
24
24
|
<V8Package>$(NuGetPackageRoot)\$(V8PackageName).$(V8Version)</V8Package>
|
package/Shared/CreateModules.h
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
|
+
// React Native
|
|
6
7
|
#include <cxxreact/CxxModule.h>
|
|
7
8
|
#include <smartPtr/cntPtr.h>
|
|
8
9
|
|
|
10
|
+
// Windows API
|
|
11
|
+
#include <winrt/Windows.Foundation.h>
|
|
12
|
+
|
|
13
|
+
// Standard Library
|
|
9
14
|
#include <memory>
|
|
10
15
|
|
|
11
16
|
// Forward declarations. Desktop projects can not access <React.h>
|
|
@@ -30,9 +35,19 @@ extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateTimingModule(
|
|
|
30
35
|
namespace Microsoft::React {
|
|
31
36
|
|
|
32
37
|
extern const char *GetHttpModuleName() noexcept;
|
|
33
|
-
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule(
|
|
38
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule(
|
|
39
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
34
40
|
|
|
35
41
|
extern const char *GetWebSocketModuleName() noexcept;
|
|
36
|
-
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateWebSocketModule(
|
|
42
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateWebSocketModule(
|
|
43
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
44
|
+
|
|
45
|
+
extern const char *GetBlobModuleName() noexcept;
|
|
46
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateBlobModule(
|
|
47
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
48
|
+
|
|
49
|
+
extern const char *GetFileReaderModuleName() noexcept;
|
|
50
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateFileReaderModule(
|
|
51
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
37
52
|
|
|
38
53
|
} // namespace Microsoft::React
|
|
@@ -86,8 +86,8 @@ struct InspectorProtocol {
|
|
|
86
86
|
for (const facebook::react::InspectorPage2 &page : pages) {
|
|
87
87
|
folly::dynamic pageDyn = folly::dynamic::object;
|
|
88
88
|
pageDyn["id"] = page.id;
|
|
89
|
-
pageDyn["title"] = std::string(page.title
|
|
90
|
-
pageDyn["vm"] = std::string(page.vm
|
|
89
|
+
pageDyn["title"] = std::string(page.title);
|
|
90
|
+
pageDyn["vm"] = std::string(page.vm);
|
|
91
91
|
|
|
92
92
|
pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSucess;
|
|
93
93
|
pageDyn["bundleUpdateTimestamp"] = bundleStatus.m_updateTimestamp;
|
|
@@ -105,8 +105,8 @@ struct InspectorProtocol {
|
|
|
105
105
|
const facebook::react::InspectorPage2 page = pages->getPage(p);
|
|
106
106
|
folly::dynamic pageDyn = folly::dynamic::object;
|
|
107
107
|
pageDyn["id"] = page.id;
|
|
108
|
-
pageDyn["title"] = page.title
|
|
109
|
-
pageDyn["vm"] = page.vm
|
|
108
|
+
pageDyn["title"] = page.title;
|
|
109
|
+
pageDyn["vm"] = page.vm;
|
|
110
110
|
|
|
111
111
|
pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSucess;
|
|
112
112
|
pageDyn["bundleUpdateTimestamp"] = bundleStatus.m_updateTimestamp;
|
|
@@ -155,11 +155,10 @@ void RemoteConnection::onDisconnect() {
|
|
|
155
155
|
RemoteConnection2::RemoteConnection2(int64_t pageId, const InspectorPackagerConnection &packagerConnection)
|
|
156
156
|
: m_packagerConnection(packagerConnection), m_pageId(pageId) {}
|
|
157
157
|
|
|
158
|
-
void RemoteConnection2::onMessage(std::
|
|
159
|
-
std::string msg(message->c_str());
|
|
158
|
+
void RemoteConnection2::onMessage(std::string message) {
|
|
160
159
|
folly::dynamic response = InspectorProtocol::constructResponseForPackager(
|
|
161
160
|
InspectorProtocol::EventType::WrappedEvent,
|
|
162
|
-
InspectorProtocol::constructVMResponsePayloadForPackager(m_pageId, std::move(
|
|
161
|
+
InspectorProtocol::constructVMResponsePayloadForPackager(m_pageId, std::move(message)));
|
|
163
162
|
std::string responsestr = folly::toJson(response);
|
|
164
163
|
m_packagerConnection.sendMessageToPackager(std::move(responsestr));
|
|
165
164
|
}
|
|
@@ -61,7 +61,7 @@ class RemoteConnection final : public facebook::react::IRemoteConnection {
|
|
|
61
61
|
class RemoteConnection2 final : public facebook::react::IRemoteConnection2 {
|
|
62
62
|
public:
|
|
63
63
|
RemoteConnection2(int64_t pageId, const InspectorPackagerConnection &packagerConnection);
|
|
64
|
-
void onMessage(std::
|
|
64
|
+
void onMessage(std::string message) override;
|
|
65
65
|
void onDisconnect() override;
|
|
66
66
|
|
|
67
67
|
private:
|
|
@@ -311,6 +311,11 @@ facebook::jsi::PropNameID ChakraRuntime::createPropNameIDFromString(const facebo
|
|
|
311
311
|
return MakePointer<facebook::jsi::PropNameID>(propertyId);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
facebook::jsi::PropNameID ChakraRuntime::createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym) {
|
|
315
|
+
const JsPropertyIdRef propSym = GetPropertyIdFromSymbol(GetJsRef(sym));
|
|
316
|
+
return MakePointer<facebook::jsi::PropNameID>(propSym);
|
|
317
|
+
}
|
|
318
|
+
|
|
314
319
|
std::string ChakraRuntime::utf8(const facebook::jsi::PropNameID &id) {
|
|
315
320
|
return Common::Unicode::Utf16ToUtf8(GetPropertyNameFromId(GetJsRef(id)));
|
|
316
321
|
}
|
|
@@ -63,6 +63,7 @@ class ChakraRuntime : public facebook::jsi::Runtime, public ChakraApi, ChakraApi
|
|
|
63
63
|
facebook::jsi::PropNameID createPropNameIDFromAscii(const char *str, size_t length) override;
|
|
64
64
|
facebook::jsi::PropNameID createPropNameIDFromUtf8(const uint8_t *utf8, size_t length) override;
|
|
65
65
|
facebook::jsi::PropNameID createPropNameIDFromString(const facebook::jsi::String &str) override;
|
|
66
|
+
facebook::jsi::PropNameID createPropNameIDFromSymbol(const facebook::jsi::Symbol &sym) override;
|
|
66
67
|
std::string utf8(const facebook::jsi::PropNameID &id) override;
|
|
67
68
|
bool compare(const facebook::jsi::PropNameID &lhs, const facebook::jsi::PropNameID &rhs) override;
|
|
68
69
|
|