@react-native/dev-middleware 0.77.0 → 0.77.1
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/dist/createDevMiddleware.js +26 -2
- package/dist/inspector-proxy/Device.js +9 -0
- package/dist/inspector-proxy/DeviceEventReporter.d.ts +1 -0
- package/dist/inspector-proxy/DeviceEventReporter.js +5 -0
- package/dist/inspector-proxy/DeviceEventReporter.js.flow +1 -0
- package/dist/types/EventReporter.d.ts +2 -1
- package/dist/types/EventReporter.js.flow +3 -0
- package/package.json +3 -2
|
@@ -32,10 +32,14 @@ function createDevMiddleware({
|
|
|
32
32
|
unstable_customInspectorMessageHandler,
|
|
33
33
|
}) {
|
|
34
34
|
const experiments = getExperiments(experimentConfig);
|
|
35
|
+
const eventReporter = createWrappedEventReporter(
|
|
36
|
+
unstable_eventReporter,
|
|
37
|
+
logger
|
|
38
|
+
);
|
|
35
39
|
const inspectorProxy = new _InspectorProxy.default(
|
|
36
40
|
projectRoot,
|
|
37
41
|
serverBaseUrl,
|
|
38
|
-
|
|
42
|
+
eventReporter,
|
|
39
43
|
experiments,
|
|
40
44
|
unstable_customInspectorMessageHandler
|
|
41
45
|
);
|
|
@@ -46,7 +50,7 @@ function createDevMiddleware({
|
|
|
46
50
|
serverBaseUrl,
|
|
47
51
|
inspectorProxy,
|
|
48
52
|
browserLauncher: unstable_browserLauncher,
|
|
49
|
-
eventReporter
|
|
53
|
+
eventReporter,
|
|
50
54
|
experiments,
|
|
51
55
|
logger,
|
|
52
56
|
})
|
|
@@ -76,3 +80,23 @@ function getExperiments(config) {
|
|
|
76
80
|
enableNetworkInspector: config.enableNetworkInspector ?? false,
|
|
77
81
|
};
|
|
78
82
|
}
|
|
83
|
+
function createWrappedEventReporter(reporter, logger) {
|
|
84
|
+
return {
|
|
85
|
+
logEvent(event) {
|
|
86
|
+
switch (event.type) {
|
|
87
|
+
case "fusebox_console_notice":
|
|
88
|
+
logger?.info(
|
|
89
|
+
"\n" +
|
|
90
|
+
"\u001B[7m" +
|
|
91
|
+
" \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be " +
|
|
92
|
+
"viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in " +
|
|
93
|
+
"the terminal to open (requires Google Chrome or Microsoft Edge)." +
|
|
94
|
+
"\u001B[27m" +
|
|
95
|
+
"\n"
|
|
96
|
+
);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
reporter?.logEvent(event);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -40,6 +40,7 @@ function _interopRequireDefault(e) {
|
|
|
40
40
|
const debug = require("debug")("Metro:InspectorProxy");
|
|
41
41
|
const PAGES_POLLING_INTERVAL = 1000;
|
|
42
42
|
const FILE_PREFIX = "file://";
|
|
43
|
+
let fuseboxConsoleNoticeLogged = false;
|
|
43
44
|
const REACT_NATIVE_RELOADABLE_PAGE_ID = "-1";
|
|
44
45
|
class Device {
|
|
45
46
|
#id;
|
|
@@ -373,6 +374,7 @@ class Device {
|
|
|
373
374
|
}
|
|
374
375
|
for (const page of this.#pages.values()) {
|
|
375
376
|
if (this.#pageHasCapability(page, "nativePageReloads")) {
|
|
377
|
+
this.#logFuseboxConsoleNotice();
|
|
376
378
|
continue;
|
|
377
379
|
}
|
|
378
380
|
if (page.title.includes("React")) {
|
|
@@ -805,5 +807,12 @@ class Device {
|
|
|
805
807
|
dangerouslyGetSocket() {
|
|
806
808
|
return this.#deviceSocket;
|
|
807
809
|
}
|
|
810
|
+
#logFuseboxConsoleNotice() {
|
|
811
|
+
if (fuseboxConsoleNoticeLogged) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
this.#deviceEventReporter?.logFuseboxConsoleNotice();
|
|
815
|
+
fuseboxConsoleNoticeLogged = true;
|
|
816
|
+
}
|
|
808
817
|
}
|
|
809
818
|
exports.default = Device;
|
|
@@ -149,6 +149,11 @@ class DeviceEventReporter {
|
|
|
149
149
|
pageId: null,
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
logFuseboxConsoleNotice() {
|
|
153
|
+
this.#eventReporter.logEvent({
|
|
154
|
+
type: "fusebox_console_notice",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
152
157
|
#logExpiredCommand(pendingCommand) {
|
|
153
158
|
this.#eventReporter.logEvent({
|
|
154
159
|
type: "debugger_command",
|
|
@@ -74,8 +74,9 @@ export type ReportableEvent =
|
|
|
74
74
|
* | ^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
75
75
|
**/
|
|
76
76
|
any
|
|
77
|
+
| { type: "fusebox_console_notice" }
|
|
77
78
|
| /**
|
|
78
|
-
* >
|
|
79
|
+
* > 90 | ...DebuggerSessionIDs,
|
|
79
80
|
* | ^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
|
|
80
81
|
**/
|
|
81
82
|
any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/dev-middleware",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.1",
|
|
4
4
|
"description": "Dev server middleware for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@isaacs/ttlcache": "^1.4.1",
|
|
26
|
-
"@react-native/debugger-frontend": "0.77.
|
|
26
|
+
"@react-native/debugger-frontend": "0.77.1",
|
|
27
27
|
"chrome-launcher": "^0.15.2",
|
|
28
28
|
"chromium-edge-launcher": "^0.2.0",
|
|
29
29
|
"connect": "^3.6.5",
|
|
30
30
|
"debug": "^2.2.0",
|
|
31
|
+
"invariant": "^2.2.4",
|
|
31
32
|
"nullthrows": "^1.1.1",
|
|
32
33
|
"open": "^7.0.3",
|
|
33
34
|
"selfsigned": "^2.4.1",
|