Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New home for reliability metrics #10

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ front_end/javascript_metadata/DOMPinnedProperties.ts

// All of the scripts in this folder are auto-generated so don't lint them.
front_end/generated/
front_end/core/react_native/generated/

// Any third_party addition has its source code checked out into
// third_party/X/package, so we ignore that code as it's not code we author or
Expand Down
19 changes: 19 additions & 0 deletions front_end/core/react_native/RNReliabilityMetrics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {type ReactNativeChromeDevToolsEvent} from './generated/type_defs/ReactNativeChromeDevToolsEventTypes.js';

type RNReliabilityMetrics = {
sendEvent: (event: ReactNativeChromeDevToolsEvent) => void,
};

export const RNReliabilityMetrics = ((): RNReliabilityMetrics => {
function sendEvent(_event: ReactNativeChromeDevToolsEvent): void {
}

return {
sendEvent,
};
})();
Comment on lines +12 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not

Suggested change
export const RNReliabilityMetrics = ((): RNReliabilityMetrics => {
function sendEvent(_event: ReactNativeChromeDevToolsEvent): void {
}
return {
sendEvent,
};
})();
export const RNReliabilityMetrics: RNReliabilityMetrics = {
sendEvent(_event: ReactNativeChromeDevToolsEvent): void {}
};

?

Also, reusing the exact same name for a type and value seems problematic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: How are we going to actually inject a sendEvent handler here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plan was for this to be a pub/sub API, so sending the actual events won't be here:

EdmondChuiHW@ecf72b6#diff-c62722ca9646ac9ec9e205faf447976c33eccbea2ce1a39791bf6f95d5041233R17

The closure style is my muscle memory for private variables + singleton; I will change it to a class + instance export instead as JS has real private fields now.

Will rework this PR to focus only on what are Reliability Metrics, how are safe defaults included, and the actual listener wiring (similar to facebook/react#22276)

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* Copyright 2024 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* @generated by xplat/js/react-native-github/scripts/debugger-frontend/gen-type-defs.js
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the latest on that? Will we sync these files manually for now?

Copy link
Author

@EdmondChuiHW EdmondChuiHW Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah friendship ended with with code gen, ⌘ + C is now my best friend.

Edited to "@​generated by WWW D54582949" instead. I still like the VSCode hover warning so people know this isn't the source of truth

image

*/

export type SetBreakpointEventEntryPoint =
| "fileGutterClicked"
| "savedStateRestored";
export type SetBreakpointEventType =
| "logpoint"
| "unconditionalBreakpoint"
| "conditionalBreakpoint";
export type SetBreakpointRequestEvent = Readonly<{
event: "Debugger.SetBreakpoint.Request";
params: Readonly<{
entryPoint: SetBreakpointEventEntryPoint;
requestID: string;
type: SetBreakpointEventType;
}>;
}>;
export type SetBreakpointResponseEvent = Readonly<{
event: "Debugger.SetBreakpoint.Response";
params: Readonly<{ breakpointID: string; requestID: string }>;
}>;
export type BreakpointResolvedEvent = Readonly<{
event: "Debugger.BreakpointResolved";
params: Readonly<{ breakpointID: string }>;
}>;
export type DebuggerPausedEvent = Readonly<{
event: "Debugger.Paused";
params: Readonly<{ breakpointID: null | undefined | string }>;
}>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* Copyright 2024 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* @generated by xplat/js/react-native-github/scripts/debugger-frontend/gen-type-defs.js
*/

import type {
BreakpointResolvedEvent,
DebuggerPausedEvent,
SetBreakpointRequestEvent,
SetBreakpointResponseEvent,
} from "ReactNativeChromeDevToolsDebuggerEventTypes";
export type ReactNativeChromeDevToolsEvent =
| SetBreakpointRequestEvent
| SetBreakpointResponseEvent
| BreakpointResolvedEvent
| DebuggerPausedEvent;
1 change: 1 addition & 0 deletions scripts/eslint_rules/lib/check_license_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const EXCLUDED_FILES = [
const META_CODE_PATHS = [
'entrypoints/rn_inspector',
'panels/rn_welcome',
'core/react_native'
];

const OTHER_LICENSE_HEADERS = [
Expand Down
Loading