react-native 0.83.5 → 0.83.6
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/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Utilities/HMRClient.js +28 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +17 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +44 -2
- package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +19 -0
- package/ReactCommon/jsinspector-modern/RuntimeAgent.h +7 -0
- package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +33 -0
- package/ReactCommon/jsinspector-modern/RuntimeTarget.h +6 -0
- package/package.json +10 -10
|
@@ -26,6 +26,7 @@ let hmrUnavailableReason: string | null = null;
|
|
|
26
26
|
let hmrOrigin: string | null = null;
|
|
27
27
|
let currentCompileErrorMessage: string | null = null;
|
|
28
28
|
let didConnect: boolean = false;
|
|
29
|
+
let lastMarkerChangeId: ?string = null;
|
|
29
30
|
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
|
|
30
31
|
|
|
31
32
|
type LogLevel =
|
|
@@ -229,10 +230,15 @@ Error: ${e.message}`;
|
|
|
229
230
|
}
|
|
230
231
|
});
|
|
231
232
|
|
|
232
|
-
client.on('update-done',
|
|
233
|
+
client.on('update-done', body => {
|
|
233
234
|
pendingUpdatesCount--;
|
|
234
235
|
if (pendingUpdatesCount === 0) {
|
|
235
236
|
DevLoadingView.hide();
|
|
237
|
+
const changeId = body?.changeId;
|
|
238
|
+
if (changeId != null && changeId !== lastMarkerChangeId) {
|
|
239
|
+
lastMarkerChangeId = changeId;
|
|
240
|
+
emitFastRefreshCompleteEvents();
|
|
241
|
+
}
|
|
236
242
|
}
|
|
237
243
|
});
|
|
238
244
|
|
|
@@ -378,4 +384,25 @@ function showCompileError() {
|
|
|
378
384
|
throw error;
|
|
379
385
|
}
|
|
380
386
|
|
|
387
|
+
function emitFastRefreshCompleteEvents() {
|
|
388
|
+
// Add marker entry in performance timeline
|
|
389
|
+
performance.mark('Fast Refresh - Update done', {
|
|
390
|
+
detail: {
|
|
391
|
+
devtools: {
|
|
392
|
+
dataType: 'marker',
|
|
393
|
+
color: 'primary',
|
|
394
|
+
tooltipText: 'Fast Refresh \u269b',
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// Notify CDP clients via internal binding
|
|
400
|
+
if (
|
|
401
|
+
// $FlowFixMe[prop-missing] - Injected by RuntimeTarget
|
|
402
|
+
typeof globalThis.__notifyFastRefreshComplete === 'function'
|
|
403
|
+
) {
|
|
404
|
+
globalThis.__notifyFastRefreshComplete();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
381
408
|
export default HMRClient;
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -50,10 +50,27 @@ RCT_EXPORT_MODULE()
|
|
|
50
50
|
selector:@selector(hide)
|
|
51
51
|
name:RCTJavaScriptDidFailToLoadNotification
|
|
52
52
|
object:nil];
|
|
53
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
54
|
+
selector:@selector(hide)
|
|
55
|
+
name:@"RCTInstanceDidLoadBundle"
|
|
56
|
+
object:nil];
|
|
53
57
|
}
|
|
54
58
|
return self;
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
- (void)dealloc
|
|
62
|
+
{
|
|
63
|
+
[self clearInitialMessageDelay];
|
|
64
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
65
|
+
UIWindow *window = _window;
|
|
66
|
+
_window = nil;
|
|
67
|
+
if (window) {
|
|
68
|
+
RCTExecuteOnMainQueue(^{
|
|
69
|
+
window.hidden = YES;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
+ (void)setEnabled:(BOOL)enabled
|
|
58
75
|
{
|
|
59
76
|
RCTDevLoadingViewSetEnabled(enabled);
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
#define REACT_NATIVE_VERSION_MAJOR 0
|
|
16
16
|
#define REACT_NATIVE_VERSION_MINOR 83
|
|
17
|
-
#define REACT_NATIVE_VERSION_PATCH
|
|
17
|
+
#define REACT_NATIVE_VERSION_PATCH 6
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
21
|
constexpr struct {
|
|
22
22
|
int32_t Major = 0;
|
|
23
23
|
int32_t Minor = 83;
|
|
24
|
-
int32_t Patch =
|
|
24
|
+
int32_t Patch = 6;
|
|
25
25
|
std::string_view Prerelease = "";
|
|
26
26
|
} ReactNativeVersion;
|
|
27
27
|
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
#include "Registration.h"
|
|
9
9
|
#include "ConnectionDemux.h"
|
|
10
10
|
|
|
11
|
-
#if defined(HERMES_ENABLE_DEBUGGER)
|
|
11
|
+
#if defined(HERMES_ENABLE_DEBUGGER)
|
|
12
|
+
|
|
13
|
+
#include <hermes/hermes.h>
|
|
14
|
+
|
|
15
|
+
#if !defined(HERMES_V1_ENABLED)
|
|
12
16
|
|
|
13
17
|
namespace facebook::hermes::inspector_modern::chrome {
|
|
14
18
|
|
|
@@ -34,4 +38,42 @@ void disableDebugging(DebugSessionToken session) {
|
|
|
34
38
|
|
|
35
39
|
} // namespace facebook::hermes::inspector_modern::chrome
|
|
36
40
|
|
|
37
|
-
#
|
|
41
|
+
#else
|
|
42
|
+
|
|
43
|
+
namespace facebook::hermes::inspector_modern {
|
|
44
|
+
class RuntimeAdapter {
|
|
45
|
+
// Backwards compatibility definition fallback for libraries that are compiled
|
|
46
|
+
// without `HERMES_V1_ENABLED` but are linked against React Native with
|
|
47
|
+
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
|
48
|
+
public:
|
|
49
|
+
virtual ~RuntimeAdapter() = 0;
|
|
50
|
+
virtual HermesRuntime& getRuntime() = 0;
|
|
51
|
+
virtual void tickleJs();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
namespace chrome {
|
|
55
|
+
|
|
56
|
+
using DebugSessionToken = int;
|
|
57
|
+
|
|
58
|
+
DebugSessionToken enableDebugging(
|
|
59
|
+
std::unique_ptr<RuntimeAdapter>,
|
|
60
|
+
const std::string&) {
|
|
61
|
+
// Backwards compatibility fallback for libraries that are compiled without
|
|
62
|
+
// `HERMES_V1_ENABLED` but are linked against React Native with
|
|
63
|
+
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
|
64
|
+
return -1;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
void disableDebugging(DebugSessionToken) {
|
|
68
|
+
// Backwards compatibility fallback for libraries that are compiled without
|
|
69
|
+
// `HERMES_V1_ENABLED` but are linked against React Native with
|
|
70
|
+
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
} // namespace chrome
|
|
74
|
+
|
|
75
|
+
} // namespace facebook::hermes::inspector_modern
|
|
76
|
+
|
|
77
|
+
#endif // !defined(HERMES_V1_ENABLED)
|
|
78
|
+
|
|
79
|
+
#endif // defined(HERMES_ENABLE_DEBUGGER)
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
#include "RuntimeAgent.h"
|
|
9
9
|
#include "SessionState.h"
|
|
10
10
|
|
|
11
|
+
#include <folly/dynamic.h>
|
|
12
|
+
#include <jsinspector-modern/cdp/CdpJson.h>
|
|
13
|
+
|
|
14
|
+
#include <chrono>
|
|
11
15
|
#include <utility>
|
|
12
16
|
|
|
13
17
|
namespace facebook::react::jsinspector_modern {
|
|
@@ -119,6 +123,21 @@ void RuntimeAgent::notifyBindingCalled(
|
|
|
119
123
|
"name", bindingName)("payload", payload)));
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
void RuntimeAgent::notifyFastRefreshComplete() {
|
|
127
|
+
if (!sessionState_.isReactNativeApplicationDomainEnabled) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
folly::dynamic params = folly::dynamic::object(
|
|
131
|
+
"timestamp",
|
|
132
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
133
|
+
std::chrono::system_clock::now().time_since_epoch())
|
|
134
|
+
.count());
|
|
135
|
+
frontendChannel_(
|
|
136
|
+
cdp::jsonNotification(
|
|
137
|
+
"ReactNativeApplication.unstable_fastRefreshComplete",
|
|
138
|
+
std::move(params)));
|
|
139
|
+
}
|
|
140
|
+
|
|
122
141
|
RuntimeAgent::ExportedState RuntimeAgent::getExportedState() {
|
|
123
142
|
return {
|
|
124
143
|
.delegateState = delegate_ ? delegate_->getExportedState() : nullptr,
|
|
@@ -72,6 +72,13 @@ class RuntimeAgent final {
|
|
|
72
72
|
|
|
73
73
|
void notifyBindingCalled(const std::string &bindingName, const std::string &payload);
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Called by RuntimeTarget when JS calls __notifyFastRefreshComplete().
|
|
77
|
+
* Emits a ReactNativeApplication.unstable_fastRefreshComplete CDP
|
|
78
|
+
* notification if the ReactNativeApplication domain is enabled.
|
|
79
|
+
*/
|
|
80
|
+
void notifyFastRefreshComplete();
|
|
81
|
+
|
|
75
82
|
struct ExportedState {
|
|
76
83
|
std::unique_ptr<RuntimeAgentDelegate::ExportedState> delegateState;
|
|
77
84
|
};
|
|
@@ -60,6 +60,8 @@ void RuntimeTarget::installGlobals() {
|
|
|
60
60
|
// NOTE: RuntimeTarget::installNetworkReporterAPI is in
|
|
61
61
|
// RuntimeTargetNetwork.cpp
|
|
62
62
|
installNetworkReporterAPI();
|
|
63
|
+
|
|
64
|
+
installFastRefreshHandler();
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
std::shared_ptr<RuntimeAgent> RuntimeTarget::createAgent(
|
|
@@ -141,6 +143,37 @@ void RuntimeTarget::installBindingHandler(const std::string& bindingName) {
|
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
void RuntimeTarget::installFastRefreshHandler() {
|
|
147
|
+
jsExecutor_([selfExecutor = executorFromThis()](jsi::Runtime& runtime) {
|
|
148
|
+
auto globalObj = runtime.global();
|
|
149
|
+
try {
|
|
150
|
+
auto name =
|
|
151
|
+
jsi::PropNameID::forUtf8(runtime, "__notifyFastRefreshComplete");
|
|
152
|
+
globalObj.setProperty(
|
|
153
|
+
runtime,
|
|
154
|
+
name,
|
|
155
|
+
jsi::Function::createFromHostFunction(
|
|
156
|
+
runtime,
|
|
157
|
+
name,
|
|
158
|
+
0,
|
|
159
|
+
[selfExecutor](
|
|
160
|
+
jsi::Runtime& /*rt*/,
|
|
161
|
+
const jsi::Value&,
|
|
162
|
+
const jsi::Value*,
|
|
163
|
+
size_t) -> jsi::Value {
|
|
164
|
+
selfExecutor([](auto& self) {
|
|
165
|
+
self.agents_.forEach(
|
|
166
|
+
[](auto& agent) { agent.notifyFastRefreshComplete(); });
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
return jsi::Value::undefined();
|
|
170
|
+
}));
|
|
171
|
+
} catch (jsi::JSError&) {
|
|
172
|
+
// Swallow JavaScript exceptions that occur while setting up the global.
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
144
177
|
void RuntimeTarget::emitDebuggerSessionCreated() {
|
|
145
178
|
jsExecutor_([selfExecutor = executorFromThis()](jsi::Runtime& runtime) {
|
|
146
179
|
try {
|
|
@@ -289,6 +289,12 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis<RuntimeTa
|
|
|
289
289
|
*/
|
|
290
290
|
void installGlobals();
|
|
291
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Installs __notifyFastRefreshComplete on the runtime's global object.
|
|
294
|
+
* When called from JS, dispatches to all connected RuntimeAgents.
|
|
295
|
+
*/
|
|
296
|
+
void installFastRefreshHandler();
|
|
297
|
+
|
|
292
298
|
/**
|
|
293
299
|
* Install the console API handler.
|
|
294
300
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.6",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -160,13 +160,13 @@
|
|
|
160
160
|
},
|
|
161
161
|
"dependencies": {
|
|
162
162
|
"@jest/create-cache-key-function": "^29.7.0",
|
|
163
|
-
"@react-native/assets-registry": "0.83.
|
|
164
|
-
"@react-native/codegen": "0.83.
|
|
165
|
-
"@react-native/community-cli-plugin": "0.83.
|
|
166
|
-
"@react-native/gradle-plugin": "0.83.
|
|
167
|
-
"@react-native/js-polyfills": "0.83.
|
|
168
|
-
"@react-native/normalize-colors": "0.83.
|
|
169
|
-
"@react-native/virtualized-lists": "0.83.
|
|
163
|
+
"@react-native/assets-registry": "0.83.6",
|
|
164
|
+
"@react-native/codegen": "0.83.6",
|
|
165
|
+
"@react-native/community-cli-plugin": "0.83.6",
|
|
166
|
+
"@react-native/gradle-plugin": "0.83.6",
|
|
167
|
+
"@react-native/js-polyfills": "0.83.6",
|
|
168
|
+
"@react-native/normalize-colors": "0.83.6",
|
|
169
|
+
"@react-native/virtualized-lists": "0.83.6",
|
|
170
170
|
"abort-controller": "^3.0.0",
|
|
171
171
|
"anser": "^1.4.9",
|
|
172
172
|
"ansi-regex": "^5.0.0",
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
"invariant": "^2.2.4",
|
|
181
181
|
"jest-environment-node": "^29.7.0",
|
|
182
182
|
"memoize-one": "^5.0.0",
|
|
183
|
-
"metro-runtime": "^0.83.
|
|
184
|
-
"metro-source-map": "^0.83.
|
|
183
|
+
"metro-runtime": "^0.83.6",
|
|
184
|
+
"metro-source-map": "^0.83.6",
|
|
185
185
|
"nullthrows": "^1.1.1",
|
|
186
186
|
"pretty-format": "^29.7.0",
|
|
187
187
|
"promise": "^8.3.0",
|