@react-native/dev-middleware
Advanced tools
Comparing version 0.74.0-nightly-20231022-02397763f to 0.74.0-nightly-20231023-1923a4e2f
@@ -112,2 +112,5 @@ "use strict"; | ||
deviceName: device.getName(), | ||
reactNative: { | ||
logicalDeviceId: deviceId, | ||
}, | ||
}; | ||
@@ -114,0 +117,0 @@ } |
@@ -41,2 +41,3 @@ /** | ||
webSocketDebuggerUrl: string; | ||
reactNative: { logicalDeviceId: string }; | ||
}; | ||
@@ -43,0 +44,0 @@ export type JsonPagesListResponse = Array<PageDescription>; |
@@ -48,3 +48,3 @@ "use strict"; | ||
const { query } = _url.default.parse(req.url, true); | ||
const { appId } = query; | ||
const { appId, device } = query; | ||
const targets = inspectorProxy.getPageDescriptions().filter( | ||
@@ -57,3 +57,3 @@ // Only use targets with better reloading support | ||
const launchType = req.method === "POST" ? "launch" : "redirect"; | ||
if (typeof appId === "string") { | ||
if (typeof appId === "string" || typeof device === "string") { | ||
logger?.info( | ||
@@ -63,3 +63,10 @@ (launchType === "launch" ? "Launching" : "Redirecting to") + | ||
); | ||
target = targets.find((_target) => _target.description === appId); | ||
if (typeof device === "string") { | ||
target = targets.find( | ||
(_target) => _target.reactNative.logicalDeviceId === device | ||
); | ||
} | ||
if (!target && typeof appId === "string") { | ||
target = targets.find((_target) => _target.description === appId); | ||
} | ||
} else { | ||
@@ -89,5 +96,9 @@ logger?.info( | ||
case "launch": | ||
await debuggerInstances.get(appId)?.kill(); | ||
const frontendInstanceId = | ||
device != null | ||
? "device:" + device | ||
: "app:" + (appId ?? "<null>"); | ||
await debuggerInstances.get(frontendInstanceId)?.kill(); | ||
debuggerInstances.set( | ||
appId, | ||
frontendInstanceId, | ||
await browserLauncher.launchDebuggerAppWindow( | ||
@@ -118,3 +129,4 @@ (0, _getDevToolsFrontendUrl.default)( | ||
status: "success", | ||
appId, | ||
appId: appId ?? null, | ||
deviceId: device ?? null, | ||
}); | ||
@@ -121,0 +133,0 @@ return; |
@@ -33,6 +33,6 @@ /** | ||
* | ^^^ | ||
* > 39 | | SuccessResult<{ appId: string }> | ||
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
* > 39 | | SuccessResult<{ appId: string | null, deviceId: string | null }> | ||
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
* > 40 | | ErrorResult<mixed> | ||
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
* > 41 | | CodedErrorResult<"NO_APPS_FOUND">, | ||
@@ -39,0 +39,0 @@ * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported. |
{ | ||
"name": "@react-native/dev-middleware", | ||
"version": "0.74.0-nightly-20231022-02397763f", | ||
"version": "0.74.0-nightly-20231023-1923a4e2f", | ||
"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-20231022-02397763f", | ||
"@react-native/debugger-frontend": "0.74.0-nightly-20231023-1923a4e2f", | ||
"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
90288
2039