react-native-windows 0.67.9 → 0.67.10
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 +66 -0
- package/CHANGELOG.md +28 -6
- package/Chakra/ChakraHelpers.cpp +0 -1
- 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/Modules/CreateModules.cpp +3 -3
- 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/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/Scripts/OfficeReact.Win32.nuspec +1 -1
- package/Shared/BaseScriptStoreImpl.cpp +1 -1
- package/Shared/CppRuntimeOptions.h +50 -0
- package/Shared/CreateModules.h +17 -2
- package/Shared/InspectorPackagerConnection.cpp +7 -5
- package/Shared/InspectorPackagerConnection.h +2 -2
- package/Shared/JSI/ChakraApi.cpp +0 -1
- package/Shared/JSI/ChakraRuntime.cpp +0 -1
- 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 +73 -70
- package/Shared/Modules/HttpModule.h +10 -3
- 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 +93 -23
- package/Shared/Modules/WebSocketModule.h +35 -6
- package/Shared/Networking/IHttpResource.h +101 -0
- package/Shared/{IWebSocketResource.h → Networking/IWebSocketResource.h} +2 -2
- package/Shared/Networking/OriginPolicy.h +15 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +747 -0
- package/Shared/Networking/OriginPolicyHttpFilter.h +112 -0
- package/Shared/Networking/WinRTHttpResource.cpp +465 -0
- package/Shared/{WinRTHttpResource.h → Networking/WinRTHttpResource.h} +35 -20
- package/Shared/Networking/WinRTTypes.h +33 -0
- package/Shared/{WinRTWebSocketResource.cpp → Networking/WinRTWebSocketResource.cpp} +2 -2
- package/Shared/{WinRTWebSocketResource.h → Networking/WinRTWebSocketResource.h} +3 -3
- package/Shared/OInstance.cpp +23 -6
- package/Shared/OInstance.h +8 -4
- package/Shared/RuntimeOptions.cpp +96 -15
- package/Shared/RuntimeOptions.h +32 -8
- package/Shared/Shared.vcxitems +24 -7
- package/Shared/Shared.vcxitems.filters +78 -21
- package/fmt/fmt.vcxproj +4 -5
- package/package.json +1 -1
- package/Shared/IHttpResource.h +0 -53
- package/Shared/WinRTHttpResource.cpp +0 -317
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Mon, 30 May 2022 15:09:33 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.67.10",
|
|
7
|
+
"version": "0.67.10",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "acoates@microsoft.com",
|
|
12
|
+
"package": "react-native-windows",
|
|
13
|
+
"commit": "1d8934a3235695ce7ef5796976a2e5c0413d3ef8",
|
|
14
|
+
"comment": "Expose LoadingState on ReactContext"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "vmorozov@microsoft.com",
|
|
18
|
+
"package": "react-native-windows",
|
|
19
|
+
"commit": "6d6015d5f24540e355160a5be62af1cc1a3903b0",
|
|
20
|
+
"comment": "Support PreparedScriptStore for V8 Node-API."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "julio@rochsquadron.net",
|
|
24
|
+
"package": "react-native-windows",
|
|
25
|
+
"commit": "932c3b9e6732b83d60b608d3d44fed7f4cc6a6de",
|
|
26
|
+
"comment": "Implement Blob module (#9352)"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "vmorozov@microsoft.com",
|
|
30
|
+
"package": "react-native-windows",
|
|
31
|
+
"commit": "13824a0805d2e9bd2eef44852029b193daf56664",
|
|
32
|
+
"comment": "Fix RuntimeOptions for RNW Desktop"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "jthysell@microsoft.com",
|
|
36
|
+
"package": "react-native-windows",
|
|
37
|
+
"commit": "93498b92be5a6900b06b35b20c4e81ba18a10647",
|
|
38
|
+
"comment": "[0.67] Change CG registration for folly and fmt from `other` to `git`"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"date": "Mon, 02 May 2022 15:10:57 GMT",
|
|
45
|
+
"tag": "react-native-windows_v0.67.9",
|
|
46
|
+
"version": "0.67.9",
|
|
47
|
+
"comments": {
|
|
48
|
+
"patch": [
|
|
49
|
+
{
|
|
50
|
+
"author": "53799235+ZihanChen-MSFT@users.noreply.github.com",
|
|
51
|
+
"package": "react-native-windows",
|
|
52
|
+
"commit": "not available",
|
|
53
|
+
"comment": "Fix clang-check errors in NativeModules.h"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "vmorozov@microsoft.com",
|
|
57
|
+
"package": "react-native-windows",
|
|
58
|
+
"commit": "not available",
|
|
59
|
+
"comment": "Fix JSI for Node-API and update V8 to 0.65.11"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "julio.rocha@microsoft.com",
|
|
63
|
+
"package": "react-native-windows",
|
|
64
|
+
"commit": "not available",
|
|
65
|
+
"comment": "Handle abrupt WebSocket connection interruption (#9829)"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
4
70
|
{
|
|
5
71
|
"date": "Mon, 02 May 2022 15:10:43 GMT",
|
|
6
72
|
"tag": "react-native-windows_v0.67.9",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
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, 30 May 2022 15:09:33 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.67.
|
|
7
|
+
## 0.67.10
|
|
8
8
|
|
|
9
|
-
Mon,
|
|
9
|
+
Mon, 30 May 2022 15:09:33 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
13
|
+
- Expose LoadingState on ReactContext (acoates@microsoft.com)
|
|
14
|
+
- Support PreparedScriptStore for V8 Node-API. (vmorozov@microsoft.com)
|
|
15
|
+
- Implement Blob module (#9352) (julio@rochsquadron.net)
|
|
16
|
+
- Fix RuntimeOptions for RNW Desktop (vmorozov@microsoft.com)
|
|
17
|
+
- [0.67] Change CG registration for folly and fmt from `other` to `git` (jthysell@microsoft.com)
|
|
16
18
|
|
|
19
|
+
## 0.67.9
|
|
20
|
+
|
|
21
|
+
Mon, 02 May 2022 15:10:57 GMT
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- Fix clang-check errors in NativeModules.h (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
26
|
+
- Fix JSI for Node-API and update V8 to 0.65.11 (vmorozov@microsoft.com)
|
|
27
|
+
- Handle abrupt WebSocket connection interruption (#9829) (julio.rocha@microsoft.com)
|
|
28
|
+
|
|
29
|
+
## 0.67.9
|
|
30
|
+
|
|
31
|
+
Mon, 02 May 2022 15:10:43 GMT
|
|
32
|
+
|
|
33
|
+
### Patches
|
|
34
|
+
|
|
35
|
+
- Fix clang-check errors in NativeModules.h (53799235+ZihanChen-MSFT@users.noreply.github.com)
|
|
36
|
+
- Fix JSI for Node-API and update V8 to 0.65.11 (vmorozov@microsoft.com)
|
|
37
|
+
- Handle abrupt WebSocket connection interruption (#9829) (julio.rocha@microsoft.com)
|
|
38
|
+
|
|
17
39
|
## 0.67.8
|
|
18
40
|
|
|
19
41
|
Mon, 25 Apr 2022 15:11:36 GMT
|
package/Chakra/ChakraHelpers.cpp
CHANGED
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
|
|
@@ -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,
|
|
@@ -49,7 +49,9 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
|
|
|
49
49
|
std::vector<facebook::react::NativeModuleDescription> modules;
|
|
50
50
|
|
|
51
51
|
modules.emplace_back(
|
|
52
|
-
"Networking",
|
|
52
|
+
"Networking",
|
|
53
|
+
[props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
|
|
54
|
+
jsMessageQueue);
|
|
53
55
|
|
|
54
56
|
modules.emplace_back(
|
|
55
57
|
"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
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
#include <CreateModules.h>
|
|
5
|
+
#include <Networking/WinRTWebSocketResource.h>
|
|
5
6
|
#include <QuirkSettings.h>
|
|
6
7
|
#include <React.h>
|
|
7
8
|
#include <ReactPropertyBag.h>
|
|
8
|
-
#include <WinRTWebSocketResource.h>
|
|
9
9
|
|
|
10
10
|
// React Native
|
|
11
11
|
#include <cxxreact/CxxModule.h>
|
|
@@ -17,11 +17,11 @@ using winrt::Microsoft::ReactNative::ReactPropertyBag;
|
|
|
17
17
|
using winrt::Microsoft::ReactNative::ReactPropertyId;
|
|
18
18
|
using winrt::Microsoft::ReactNative::implementation::QuirkSettings;
|
|
19
19
|
|
|
20
|
-
namespace Microsoft::React {
|
|
20
|
+
namespace Microsoft::React::Networking {
|
|
21
21
|
|
|
22
22
|
std::shared_ptr<IWebSocketResource> IWebSocketResource::Make() {
|
|
23
23
|
std::vector<winrt::Windows::Security::Cryptography::Certificates::ChainValidationResult> certExceptions;
|
|
24
24
|
return std::make_shared<WinRTWebSocketResource>(std::move(certExceptions));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
} // namespace Microsoft::React
|
|
27
|
+
} // namespace Microsoft::React::Networking
|
|
@@ -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.10.0-ms.1" 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
|
|
@@ -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.10</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>67</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>10</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
18
|
</PropertyGroup>
|
|
19
19
|
</Project>
|
|
@@ -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>
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
<file src="$nugetroot$\inc\Shared\IReactRootView.h" target="inc"/>
|
|
51
51
|
<file src="$nugetroot$\inc\Shared\IRedBoxHandler.h" target="inc"/>
|
|
52
52
|
<file src="$nugetroot$\inc\Shared\IUIManager.h" target="inc"/>
|
|
53
|
-
<file src="$nugetroot$\inc\Shared\IWebSocketResource.h" target="inc"/>
|
|
54
53
|
<file src="$nugetroot$\inc\Shared\JSBigAbiString.h" target="inc"/>
|
|
55
54
|
<file src="$nugetroot$\inc\Shared\LayoutAnimation.h" target="inc"/>
|
|
56
55
|
<file src="$nugetroot$\inc\Shared\Logging.h" target="inc"/>
|
|
57
56
|
<file src="$nugetroot$\inc\Shared\MemoryMappedBuffer.h" target="inc"/>
|
|
58
57
|
<file src="$nugetroot$\inc\Shared\Modules\I18nModule.h" target="inc"/>
|
|
59
58
|
<file src="$nugetroot$\inc\Shared\NativeModuleProvider.h" target="inc"/>
|
|
59
|
+
<file src="$nugetroot$\inc\Shared\Networking\IWebSocketResource.h" target="inc"/>
|
|
60
60
|
<file src="$nugetroot$\inc\Shared\RuntimeOptions.h" target="inc"/>
|
|
61
61
|
<file src="$nugetroot$\inc\ReactWin32\ShadowNode.h" target="inc"/>
|
|
62
62
|
<file src="$nugetroot$\inc\Shared\Tracing.h" target="inc"/>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <string>
|
|
7
|
+
|
|
8
|
+
namespace Microsoft::React {
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Sets a global boolean value identified by an arbitrary string.
|
|
12
|
+
/// </summary>
|
|
13
|
+
/// <param name="name">Global key</param>
|
|
14
|
+
void __cdecl SetRuntimeOptionBool(std::string &&name, bool value) noexcept;
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Sets a global signed integer value identified by an arbitrary string.
|
|
18
|
+
/// </summary>
|
|
19
|
+
/// <param name="name">Global boolean key</param>
|
|
20
|
+
void __cdecl SetRuntimeOptionInt(std::string &&name, std::int32_t value) noexcept;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Sets a global string value identified by an arbitrary string.
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <param name="name">Global string key</param>
|
|
26
|
+
/// <param name="value">String value to store</param>
|
|
27
|
+
void __cdecl SetRuntimeOptionString(std::string &&name, std::string &&value) noexcept;
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
/// Retrieves a global boolean value for the given key.
|
|
31
|
+
/// </summary>
|
|
32
|
+
/// <param name="name">Global boolean key</param>
|
|
33
|
+
/// <returns>Value stored for the given key, or false if the entry doesn't exist (default)</returns>
|
|
34
|
+
const bool __cdecl GetRuntimeOptionBool(const std::string &name) noexcept;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Retrieves a global boolean value for the given key.
|
|
38
|
+
/// </summary>
|
|
39
|
+
/// <param name="name">Global key</param>
|
|
40
|
+
/// <returns>Value stored for the given key, or 0 if the entry doesn't exist (default)</returns>
|
|
41
|
+
const std::int32_t __cdecl GetRuntimeOptionInt(const std::string &name) noexcept;
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Retrieves a global string value for the given key.
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <param name="name">Global key</param>
|
|
47
|
+
/// <returns>Value stored for the given key, or an empty string if the entry doesn't exist (default)</returns>
|
|
48
|
+
const std::string __cdecl GetRuntimeOptionString(const std::string &name) noexcept;
|
|
49
|
+
|
|
50
|
+
} // namespace Microsoft::React
|
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>
|
|
@@ -33,9 +38,19 @@ extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateAsyncStorageMod
|
|
|
33
38
|
namespace Microsoft::React {
|
|
34
39
|
|
|
35
40
|
extern const char *GetHttpModuleName() noexcept;
|
|
36
|
-
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule(
|
|
41
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule(
|
|
42
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
37
43
|
|
|
38
44
|
extern const char *GetWebSocketModuleName() noexcept;
|
|
39
|
-
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateWebSocketModule(
|
|
45
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateWebSocketModule(
|
|
46
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
47
|
+
|
|
48
|
+
extern const char *GetBlobModuleName() noexcept;
|
|
49
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateBlobModule(
|
|
50
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
51
|
+
|
|
52
|
+
extern const char *GetFileReaderModuleName() noexcept;
|
|
53
|
+
extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateFileReaderModule(
|
|
54
|
+
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept;
|
|
40
55
|
|
|
41
56
|
} // namespace Microsoft::React
|
|
@@ -196,7 +196,8 @@ InspectorPackagerConnection::InspectorPackagerConnection(
|
|
|
196
196
|
winrt::fire_and_forget InspectorPackagerConnection::disconnectAsync() {
|
|
197
197
|
co_await winrt::resume_background();
|
|
198
198
|
std::string reason("Explicit close");
|
|
199
|
-
m_packagerWebSocketConnection->Close(
|
|
199
|
+
m_packagerWebSocketConnection->Close(
|
|
200
|
+
Microsoft::React::Networking::WinRTWebSocketResource::CloseCode::GoingAway, reason);
|
|
200
201
|
co_return;
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -204,9 +205,10 @@ winrt::fire_and_forget InspectorPackagerConnection::connectAsync() {
|
|
|
204
205
|
co_await winrt::resume_background();
|
|
205
206
|
|
|
206
207
|
std::vector<winrt::Windows::Security::Cryptography::Certificates::ChainValidationResult> certExceptions;
|
|
207
|
-
m_packagerWebSocketConnection =
|
|
208
|
+
m_packagerWebSocketConnection =
|
|
209
|
+
std::make_shared<Microsoft::React::Networking::WinRTWebSocketResource>(std::move(certExceptions));
|
|
208
210
|
|
|
209
|
-
m_packagerWebSocketConnection->SetOnError([](const Microsoft::React::IWebSocketResource::Error &err) {
|
|
211
|
+
m_packagerWebSocketConnection->SetOnError([](const Microsoft::React::Networking::IWebSocketResource::Error &err) {
|
|
210
212
|
facebook::react::tracing::error(err.Message.c_str());
|
|
211
213
|
});
|
|
212
214
|
|
|
@@ -267,8 +269,8 @@ winrt::fire_and_forget InspectorPackagerConnection::connectAsync() {
|
|
|
267
269
|
}
|
|
268
270
|
});
|
|
269
271
|
|
|
270
|
-
Microsoft::React::IWebSocketResource::Protocols protocols;
|
|
271
|
-
Microsoft::React::IWebSocketResource::Options options;
|
|
272
|
+
Microsoft::React::Networking::IWebSocketResource::Protocols protocols;
|
|
273
|
+
Microsoft::React::Networking::IWebSocketResource::Options options;
|
|
272
274
|
m_packagerWebSocketConnection->Connect(std::string{m_url}, protocols, options);
|
|
273
275
|
|
|
274
276
|
co_return;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
6
|
#include <InspectorProxy.h>
|
|
7
|
-
#include <WinRTWebSocketResource.h>
|
|
7
|
+
#include <Networking/WinRTWebSocketResource.h>
|
|
8
8
|
#include <jsinspector/InspectorInterfaces.h>
|
|
9
9
|
|
|
10
10
|
namespace Microsoft::ReactNative {
|
|
@@ -42,7 +42,7 @@ class InspectorPackagerConnection final : public std::enable_shared_from_this<In
|
|
|
42
42
|
void sendMessageToVM(int64_t pageId, std::string &&message);
|
|
43
43
|
|
|
44
44
|
std::unordered_map<int64_t, std::unique_ptr<facebook::react::ILocalConnection>> m_localConnections;
|
|
45
|
-
std::shared_ptr<Microsoft::React::WinRTWebSocketResource> m_packagerWebSocketConnection;
|
|
45
|
+
std::shared_ptr<Microsoft::React::Networking::WinRTWebSocketResource> m_packagerWebSocketConnection;
|
|
46
46
|
std::shared_ptr<IBundleStatusProvider> m_bundleStatusProvider;
|
|
47
47
|
std::string m_url;
|
|
48
48
|
};
|
package/Shared/JSI/ChakraApi.cpp
CHANGED