@react-native/dev-middleware
Advanced tools
Comparing version 0.74.0-nightly-20231105-d077239ff to 0.74.0-nightly-20231106-1e21e3469
@@ -39,3 +39,3 @@ /** | ||
_deviceSocket: WS; | ||
_pages: Array<Page>; | ||
_pages: ReadonlyArray<Page>; | ||
_debuggerConnection: null | undefined | DebuggerInfo; | ||
@@ -58,3 +58,3 @@ _lastConnectedReactNativePage: null | undefined | Page; | ||
getApp(): string; | ||
getPagesList(): Array<Page>; | ||
getPagesList(): ReadonlyArray<Page>; | ||
handleDebuggerConnection( | ||
@@ -78,7 +78,7 @@ socket: WS, | ||
socket: WS | ||
): boolean; | ||
): null | undefined | DebuggerRequest; | ||
_processDebuggerSetBreakpointByUrl( | ||
req: SetBreakpointByUrlRequest, | ||
debuggerInfo: DebuggerInfo | ||
): void; | ||
): SetBreakpointByUrlRequest; | ||
_processDebuggerGetScriptSource( | ||
@@ -85,0 +85,0 @@ req: GetScriptSourceRequest, |
@@ -215,3 +215,3 @@ "use strict"; | ||
}); | ||
const handled = this._interceptMessageFromDebugger( | ||
const processedReq = this._interceptMessageFromDebugger( | ||
debuggerRequest, | ||
@@ -221,3 +221,3 @@ debuggerInfo, | ||
); | ||
if (!handled) { | ||
if (processedReq) { | ||
this._sendMessageToDevice({ | ||
@@ -227,3 +227,3 @@ event: "wrappedEvent", | ||
pageId: this._mapToDevicePageId(pageId), | ||
wrappedEvent: JSON.stringify(debuggerRequest), | ||
wrappedEvent: JSON.stringify(processedReq), | ||
}, | ||
@@ -552,8 +552,8 @@ }); | ||
if (req.method === "Debugger.setBreakpointByUrl") { | ||
this._processDebuggerSetBreakpointByUrl(req, debuggerInfo); | ||
return this._processDebuggerSetBreakpointByUrl(req, debuggerInfo); | ||
} else if (req.method === "Debugger.getScriptSource") { | ||
this._processDebuggerGetScriptSource(req, socket); | ||
return true; | ||
return null; | ||
} | ||
return false; | ||
return req; | ||
} | ||
@@ -563,4 +563,10 @@ _processDebuggerSetBreakpointByUrl(req, debuggerInfo) { | ||
if (debuggerInfo.originalSourceURLAddress != null) { | ||
if (req.params.url != null) { | ||
req.params.url = req.params.url.replace( | ||
const processedReq = { | ||
...req, | ||
params: { | ||
...req.params, | ||
}, | ||
}; | ||
if (processedReq.params.url != null) { | ||
processedReq.params.url = processedReq.params.url.replace( | ||
"localhost", | ||
@@ -570,4 +576,4 @@ debuggerInfo.originalSourceURLAddress | ||
if ( | ||
req.params.url && | ||
req.params.url.startsWith(FILE_PREFIX) && | ||
processedReq.params.url && | ||
processedReq.params.url.startsWith(FILE_PREFIX) && | ||
debuggerInfo.prependedFilePrefix | ||
@@ -577,7 +583,9 @@ ) { | ||
// $FlowFixMe[incompatible-use] | ||
req.params.url = req.params.url.slice(FILE_PREFIX.length); | ||
processedReq.params.url = processedReq.params.url.slice( | ||
FILE_PREFIX.length | ||
); | ||
} | ||
} | ||
if (req.params.urlRegex != null) { | ||
req.params.urlRegex = req.params.urlRegex.replace( | ||
if (processedReq.params.urlRegex != null) { | ||
processedReq.params.urlRegex = processedReq.params.urlRegex.replace( | ||
/localhost/g, | ||
@@ -588,3 +596,5 @@ // $FlowFixMe[incompatible-call] | ||
} | ||
return processedReq; | ||
} | ||
return req; | ||
} | ||
@@ -591,0 +601,0 @@ _processDebuggerGetScriptSource(req, socket) { |
@@ -12,14 +12,25 @@ /** | ||
export type Page = { id: string; title: string; vm: string; app: string }; | ||
export type WrappedEvent = { | ||
export type Page = Readonly<{ | ||
id: string; | ||
title: string; | ||
vm: string; | ||
app: string; | ||
}>; | ||
export type WrappedEvent = Readonly<{ | ||
event: "wrappedEvent"; | ||
payload: { pageId: string; wrappedEvent: string }; | ||
}; | ||
export type ConnectRequest = { event: "connect"; payload: { pageId: string } }; | ||
export type DisconnectRequest = { | ||
payload: Readonly<{ pageId: string; wrappedEvent: string }>; | ||
}>; | ||
export type ConnectRequest = Readonly<{ | ||
event: "connect"; | ||
payload: Readonly<{ pageId: string }>; | ||
}>; | ||
export type DisconnectRequest = Readonly<{ | ||
event: "disconnect"; | ||
payload: { pageId: string }; | ||
payload: Readonly<{ pageId: string }>; | ||
}>; | ||
export type GetPagesRequest = { event: "getPages" }; | ||
export type GetPagesResponse = { | ||
event: "getPages"; | ||
payload: ReadonlyArray<Page>; | ||
}; | ||
export type GetPagesRequest = { event: "getPages" }; | ||
export type GetPagesResponse = { event: "getPages"; payload: Array<Page> }; | ||
export type MessageFromDevice = | ||
@@ -34,3 +45,3 @@ | GetPagesResponse | ||
| DisconnectRequest; | ||
export type PageDescription = { | ||
export type PageDescription = Readonly<{ | ||
id: string; | ||
@@ -43,9 +54,11 @@ description: string; | ||
webSocketDebuggerUrl: string; | ||
reactNative: { logicalDeviceId: string }; | ||
}; | ||
export type JsonPagesListResponse = Array<PageDescription>; | ||
export type JsonVersionResponse = { | ||
deviceName: string; | ||
vm: string; | ||
reactNative: Readonly<{ logicalDeviceId: string }>; | ||
}>; | ||
export type JsonPagesListResponse = ReadonlyArray<PageDescription>; | ||
export type JsonVersionResponse = Readonly<{ | ||
Browser: string; | ||
"Protocol-Version": string; | ||
}; | ||
}>; | ||
/** | ||
@@ -55,6 +68,6 @@ * Types were exported from https://github.com/ChromeDevTools/devtools-protocol/blob/master/types/protocol.d.ts | ||
export type SetBreakpointByUrlRequest = { | ||
export type SetBreakpointByUrlRequest = Readonly<{ | ||
id: number; | ||
method: "Debugger.setBreakpointByUrl"; | ||
params: { | ||
params: Readonly<{ | ||
lineNumber: number; | ||
@@ -66,10 +79,10 @@ url?: string; | ||
condition?: string; | ||
}; | ||
}; | ||
export type GetScriptSourceRequest = { | ||
}>; | ||
}>; | ||
export type GetScriptSourceRequest = Readonly<{ | ||
id: number; | ||
method: "Debugger.getScriptSource"; | ||
params: { scriptId: string }; | ||
}; | ||
export type GetScriptSourceResponse = { | ||
}>; | ||
export type GetScriptSourceResponse = Readonly<{ | ||
scriptSource: string; | ||
@@ -80,6 +93,6 @@ /** | ||
bytecode?: string; | ||
}; | ||
export type ErrorResponse = { error: { message: string } }; | ||
}>; | ||
export type ErrorResponse = Readonly<{ error: Readonly<{ message: string }> }>; | ||
export type DebuggerRequest = | ||
| SetBreakpointByUrlRequest | ||
| GetScriptSourceRequest; |
{ | ||
"name": "@react-native/dev-middleware", | ||
"version": "0.74.0-nightly-20231105-d077239ff", | ||
"version": "0.74.0-nightly-20231106-1e21e3469", | ||
"description": "Dev server middleware for React Native", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"@isaacs/ttlcache": "^1.4.1", | ||
"@react-native/debugger-frontend": "0.74.0-nightly-20231105-d077239ff", | ||
"@react-native/debugger-frontend": "0.74.0-nightly-20231106-1e21e3469", | ||
"chrome-launcher": "^0.15.2", | ||
@@ -29,0 +29,0 @@ "chromium-edge-launcher": "^1.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91073
2062