Skip to content

Commit 0eb7c90

Browse files
authored
Migrate FuseboxClient domain to a codegenned agent (#64)
1 parent f657b1f commit 0eb7c90

File tree

9 files changed

+68
-7
lines changed

9 files changed

+68
-7
lines changed

front_end/core/protocol_client/InspectorBackend.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ export class TargetBase {
672672
return this.getAgent('Fetch');
673673
}
674674

675+
fuseboxClientAgent(): ProtocolProxyApi.FuseboxClientApi {
676+
return this.getAgent('FuseboxClient');
677+
}
678+
675679
heapProfilerAgent(): ProtocolProxyApi.HeapProfilerApi {
676680
return this.getAgent('HeapProfiler');
677681
}

front_end/entrypoints/rn_fusebox/rn_fusebox.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,7 @@ Host.rnPerfMetrics.entryPointLoadingStarted('rn_fusebox');
7575
class FuseboxClientMetadataModel extends SDK.SDKModel.SDKModel<void> {
7676
constructor(target: SDK.Target.Target) {
7777
super(target);
78-
target.router()?.sendMessage(
79-
target.sessionId,
80-
'FuseboxClient',
81-
'FuseboxClient.setClientMetadata' as InspectorBackend.QualifiedName,
82-
{},
83-
() => {},
84-
);
78+
void target.fuseboxClientAgent().invoke_setClientMetadata();
8579
}
8680
}
8781

front_end/generated/InspectorBackendCommands.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front_end/generated/protocol-mapping.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,17 @@ export namespace ProtocolMapping {
760760
}
761761

762762
export interface Commands {
763+
/**
764+
* Identifies the current client as being Fusebox.
765+
*
766+
* The Fusebox backend may use this knowledge to print an informational
767+
* message to the console, etc. The client should send this before enabling
768+
* the Runtime and Log domains.
769+
*/
770+
'FuseboxClient.setClientMetadata': {
771+
paramsType: [];
772+
returnType: void;
773+
};
763774
/**
764775
* Disables the accessibility domain.
765776
*/

front_end/generated/protocol-proxy-api.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ declare namespace ProtocolProxyApi {
1818
export type ProtocolDomainName = keyof ProtocolApi;
1919

2020
export interface ProtocolApi {
21+
FuseboxClient: FuseboxClientApi;
22+
2123
Accessibility: AccessibilityApi;
2224

2325
Animation: AnimationApi;
@@ -119,6 +121,8 @@ declare namespace ProtocolProxyApi {
119121
}
120122

121123
export interface ProtocolDispatchers {
124+
FuseboxClient: FuseboxClientDispatcher;
125+
122126
Accessibility: AccessibilityDispatcher;
123127

124128
Animation: AnimationDispatcher;
@@ -220,6 +224,20 @@ declare namespace ProtocolProxyApi {
220224
}
221225

222226

227+
export interface FuseboxClientApi {
228+
/**
229+
* Identifies the current client as being Fusebox.
230+
*
231+
* The Fusebox backend may use this knowledge to print an informational
232+
* message to the console, etc. The client should send this before enabling
233+
* the Runtime and Log domains.
234+
*/
235+
invoke_setClientMetadata(): Promise<Protocol.ProtocolResponseWithError>;
236+
237+
}
238+
export interface FuseboxClientDispatcher {
239+
}
240+
223241
export interface AccessibilityApi {
224242
/**
225243
* Disables the accessibility domain.

front_end/generated/protocol.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export interface ProtocolResponseWithError {
1818
type OpaqueType<Tag extends string> = {protocolOpaqueTypeTag: Tag};
1919
type OpaqueIdentifier<RepresentationType, Tag extends string> = RepresentationType&OpaqueType<Tag>;
2020

21+
/**
22+
* A React Native-specific domain pertaining to the Fusebox (React Native
23+
* DevTools) client.
24+
*/
25+
export namespace FuseboxClient {
26+
}
27+
2128
export namespace Accessibility {
2229

2330
/**

scripts/deps/generate_protocol_resources.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def main():
142142
popen([GENERATE_DEPRECATIONS_SCRIPT])
143143

144144
popen([CONCATENATE_PROTOCOL_SCRIPT] + [
145+
path.join(PROTOCOL_LOCATION, 'react_native_domains.pdl'),
145146
path.join(PROTOCOL_LOCATION, 'browser_protocol.pdl'),
146147
path.join(V8_DIRECTORY_PATH, 'include', 'js_protocol.pdl'),
147148
# output_file

third_party/blink/public/devtools_protocol/browser_protocol.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
"minor": "3"
55
},
66
"domains": [
7+
{
8+
"domain": "FuseboxClient",
9+
"description": "A React Native-specific domain pertaining to the Fusebox (React Native\nDevTools) client.",
10+
"experimental": true,
11+
"commands": [
12+
{
13+
"name": "setClientMetadata",
14+
"description": "Identifies the current client as being Fusebox.\n\nThe Fusebox backend may use this knowledge to print an informational\nmessage to the console, etc. The client should send this before enabling\nthe Runtime and Log domains."
15+
}
16+
]
17+
},
718
{
819
"domain": "Accessibility",
920
"experimental": true,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
# A React Native-specific domain pertaining to the Fusebox (React Native
4+
# DevTools) client.
5+
experimental domain FuseboxClient
6+
7+
# Identifies the current client as being Fusebox.
8+
#
9+
# The Fusebox backend may use this knowledge to print an informational
10+
# message to the console, etc. The client should send this before enabling
11+
# the Runtime and Log domains.
12+
command setClientMetadata

0 commit comments

Comments
 (0)