@react-native/dev-middleware
Advanced tools
Comparing version 0.74.0-nightly-20231009-ec1de6194 to 0.74.0-nightly-20231010-7b7f12896
@@ -13,2 +13,5 @@ "use strict"; | ||
var _serveStatic = _interopRequireDefault(require("serve-static")); | ||
var _deprecated_openFlipperMiddleware = _interopRequireDefault( | ||
require("./middleware/deprecated_openFlipperMiddleware") | ||
); | ||
var _openDebuggerMiddleware = _interopRequireDefault( | ||
@@ -37,4 +40,2 @@ require("./middleware/openDebuggerMiddleware") | ||
// $FlowFixMe[untyped-import] TODO: type serve-static | ||
function createDevMiddleware({ | ||
@@ -58,10 +59,14 @@ projectRoot, | ||
"/open-debugger", | ||
(0, _openDebuggerMiddleware.default)({ | ||
serverBaseUrl, | ||
inspectorProxy, | ||
browserLauncher: unstable_browserLauncher, | ||
eventReporter: unstable_eventReporter, | ||
experiments, | ||
logger, | ||
}) | ||
experiments.enableNewDebugger | ||
? (0, _openDebuggerMiddleware.default)({ | ||
serverBaseUrl, | ||
inspectorProxy, | ||
browserLauncher: unstable_browserLauncher, | ||
eventReporter: unstable_eventReporter, | ||
experiments, | ||
logger, | ||
}) | ||
: (0, _deprecated_openFlipperMiddleware.default)({ | ||
logger, | ||
}) | ||
) | ||
@@ -82,5 +87,5 @@ .use( | ||
return { | ||
enableCustomDebuggerFrontend: config.enableCustomDebuggerFrontend ?? false, | ||
enableNewDebugger: config.enableNewDebugger ?? false, | ||
enableOpenDebuggerRedirect: config.enableOpenDebuggerRedirect ?? false, | ||
}; | ||
} |
@@ -59,3 +59,3 @@ "use strict"; | ||
(launchType === "launch" ? "Launching" : "Redirecting to") + | ||
" JS debugger..." | ||
" JS debugger (experimental)..." | ||
); | ||
@@ -93,4 +93,3 @@ target = targets.find((_target) => _target.description === appId); | ||
target.webSocketDebuggerUrl, | ||
serverBaseUrl, | ||
experiments | ||
serverBaseUrl | ||
) | ||
@@ -106,4 +105,3 @@ ) | ||
// Use a relative URL. | ||
"", | ||
experiments | ||
"" | ||
), | ||
@@ -110,0 +108,0 @@ }); |
@@ -13,6 +13,7 @@ /** | ||
/** | ||
* Enables the use of the custom debugger frontend (@react-native/debugger-frontend) | ||
* in the /open-debugger endpoint. | ||
* Enables the new JS debugger launch flow and custom debugger frontend | ||
* (@react-native/debugger-frontend). When disabled, /open-debugger will | ||
* trigger the legacy Flipper connection flow. | ||
*/ | ||
enableCustomDebuggerFrontend: boolean; | ||
enableNewDebugger: boolean; | ||
/** | ||
@@ -19,0 +20,0 @@ * Enables the handling of GET requests in the /open-debugger endpoint, |
@@ -12,11 +12,9 @@ /** | ||
import type { Experiments } from "../types/Experiments"; | ||
/** | ||
* Construct the URL to Chrome DevTools connected to a given debugger target. | ||
* Get the DevTools frontend URL to debug a given React Native CDP target. | ||
*/ | ||
declare function getDevToolsFrontendUrl( | ||
webSocketDebuggerUrl: string, | ||
devServerUrl: string, | ||
experiments: Experiments | ||
devServerUrl: string | ||
): string; | ||
export default getDevToolsFrontendUrl; |
@@ -19,31 +19,10 @@ "use strict"; | ||
/** | ||
* The Chrome DevTools frontend revision to use. This should be set to the | ||
* latest version known to be compatible with Hermes. | ||
* | ||
* Revision should be the full identifier from: | ||
* https://chromium.googlesource.com/chromium/src.git | ||
* Get the DevTools frontend URL to debug a given React Native CDP target. | ||
*/ | ||
const DEVTOOLS_FRONTEND_REV = "d9568d04d7dd79269c5a655d7ada69650c5a8336"; // Chrome 100.0.4896.75 | ||
/** | ||
* Construct the URL to Chrome DevTools connected to a given debugger target. | ||
*/ | ||
function getDevToolsFrontendUrl( | ||
webSocketDebuggerUrl, | ||
devServerUrl, | ||
experiments | ||
) { | ||
function getDevToolsFrontendUrl(webSocketDebuggerUrl, devServerUrl) { | ||
const scheme = new URL(webSocketDebuggerUrl).protocol.slice(0, -1); | ||
const webSocketUrlWithoutProtocol = webSocketDebuggerUrl.replace( | ||
/^wss?:\/\//, | ||
"" | ||
const webSocketUrlWithoutProtocol = encodeURIComponent( | ||
webSocketDebuggerUrl.replace(/^wss?:\/\//, "") | ||
); | ||
if (experiments.enableCustomDebuggerFrontend) { | ||
return `${`${devServerUrl}/debugger-frontend/rn_inspector.html`}?${scheme}=${encodeURIComponent( | ||
webSocketUrlWithoutProtocol | ||
)}&sources.hide_add_folder=true`; | ||
} | ||
return `${`https://chrome-devtools-frontend.appspot.com/serve_rev/@${DEVTOOLS_FRONTEND_REV}/devtools_app.html`}?panel=console&${scheme}=${encodeURIComponent( | ||
webSocketUrlWithoutProtocol | ||
)}`; | ||
return `${`${devServerUrl}/debugger-frontend/rn_inspector.html`}?${scheme}=${webSocketUrlWithoutProtocol}&sources.hide_add_folder=true`; | ||
} |
{ | ||
"name": "@react-native/dev-middleware", | ||
"version": "0.74.0-nightly-20231009-ec1de6194", | ||
"version": "0.74.0-nightly-20231010-7b7f12896", | ||
"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-20231009-ec1de6194", | ||
"@react-native/debugger-frontend": "0.74.0-nightly-20231010-7b7f12896", | ||
"chrome-launcher": "^0.15.2", | ||
@@ -33,2 +33,3 @@ "chromium-edge-launcher": "^1.0.0", | ||
"node-fetch": "^2.2.0", | ||
"open": "^7.0.3", | ||
"serve-static": "^1.13.1", | ||
@@ -35,0 +36,0 @@ "temp-dir": "^2.0.0" |
@@ -61,2 +61,6 @@ # @react-native/dev-middleware | ||
#### GET `/debugger-frontend` | ||
Subpaths of this endpoint are reserved to serve the JavaScript debugger frontend. | ||
#### POST `/open-debugger` | ||
@@ -63,0 +67,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
89392
47
2022
90
10
+ Addedopen@^7.0.3
+ Added@react-native/debugger-frontend@0.74.0-nightly-20231010-7b7f12896(transitive)
+ Added@types/node@22.9.1(transitive)
+ Addedopen@7.4.2(transitive)
- Removed@react-native/debugger-frontend@0.74.0-nightly-20231009-ec1de6194(transitive)
- Removed@types/node@22.9.3(transitive)
Updated@react-native/debugger-frontend@0.74.0-nightly-20231010-7b7f12896