Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-native/dev-middleware

Package Overview
Dependencies
Maintainers
2
Versions
500
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native/dev-middleware - npm Package Compare versions

Comparing version 0.77.0-nightly-20241121-550b0c0ed to 0.77.0-nightly-20241122-e4d8c9678

5

dist/inspector-proxy/Device.d.ts

@@ -40,3 +40,6 @@ /**

pageId: string,
metadata: Readonly<{ userAgent: string | null }>
$$PARAM_2$$: Readonly<{
debuggerRelativeBaseUrl: URL;
userAgent: string | null;
}>
): void;

@@ -43,0 +46,0 @@ dangerouslyGetSocket(): WS;

108

dist/inspector-proxy/Device.js

@@ -170,2 +170,3 @@ "use strict";

this.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId, {
debuggerRelativeBaseUrl: oldDebugger.debuggerRelativeBaseUrl,
userAgent: oldDebugger.userAgent,

@@ -189,3 +190,7 @@ });

}
handleDebuggerConnection(socket, pageId, metadata) {
handleDebuggerConnection(
socket,
pageId,
{ debuggerRelativeBaseUrl, userAgent }
) {
const page =

@@ -197,5 +202,4 @@ pageId === REACT_NATIVE_RELOADABLE_PAGE_ID

debug(
`Got new debugger connection for page ${pageId} of ${
this.#name
}, but no such page exists`
`Got new debugger connection via ${debuggerRelativeBaseUrl.href} for ` +
`page ${pageId} of ${this.#name}, but no such page exists`
);

@@ -209,3 +213,3 @@ socket.close();

pageId,
frontendUserAgent: metadata.userAgent,
frontendUserAgent: userAgent,
});

@@ -216,7 +220,11 @@ const debuggerInfo = {

pageId,
userAgent: metadata.userAgent,
userAgent: userAgent,
customHandler: null,
debuggerRelativeBaseUrl,
};
this.#debuggerConnection = debuggerInfo;
debug(`Got new debugger connection for page ${pageId} of ${this.#name}`);
debug(
`Got new debugger connection via ${debuggerRelativeBaseUrl.href} for ` +
`page ${pageId} of ${this.#name}`
);
if (this.#debuggerConnection && this.#createCustomMessageHandler) {

@@ -270,3 +278,3 @@ this.#debuggerConnection.customHandler = this.#createCustomMessageHandler(

pageId: this.#debuggerConnection?.pageId ?? null,
frontendUserAgent: metadata.userAgent,
frontendUserAgent: userAgent,
prefersFuseboxFrontend: this.#isPageFuseboxFrontend(

@@ -518,7 +526,10 @@ this.#debuggerConnection?.pageId

const debuggerRelativeURL = new URL(sourceMapURL.href);
debuggerRelativeURL.hostname = "localhost";
debuggerRelativeURL.host =
debuggerInfo.debuggerRelativeBaseUrl.host;
debuggerRelativeURL.protocol =
debuggerInfo.debuggerRelativeBaseUrl.protocol;
serverRelativeUrl.host = this.#serverRelativeBaseUrl.host;
serverRelativeUrl.protocol = this.#serverRelativeBaseUrl.protocol;
debuggerInfo.originalSourceURLAddress =
this.#deviceRelativeBaseUrl.hostname;
debuggerInfo.originalSourceURLOrigin =
this.#deviceRelativeBaseUrl.origin;
payload.params.sourceMapURL = debuggerRelativeURL.href;

@@ -539,5 +550,4 @@ }

if ("url" in params) {
const originalParamsUrl = params.url;
let serverRelativeUrl = originalParamsUrl;
const parsedUrl = this.#tryParseHTTPURL(originalParamsUrl);
let serverRelativeUrl = params.url;
const parsedUrl = this.#tryParseHTTPURL(params.url);
if (

@@ -548,6 +558,7 @@ parsedUrl &&

) {
parsedUrl.hostname = "localhost";
parsedUrl.host = debuggerInfo.debuggerRelativeBaseUrl.host;
parsedUrl.protocol = debuggerInfo.debuggerRelativeBaseUrl.protocol;
payload.params.url = parsedUrl.href;
debuggerInfo.originalSourceURLAddress =
this.#deviceRelativeBaseUrl.hostname;
debuggerInfo.originalSourceURLOrigin =
this.#deviceRelativeBaseUrl.origin;
parsedUrl.host = this.#serverRelativeBaseUrl.host;

@@ -630,33 +641,40 @@ parsedUrl.protocol = this.#serverRelativeBaseUrl.protocol;

#processDebuggerSetBreakpointByUrl(req, debuggerInfo) {
if (debuggerInfo.originalSourceURLAddress != null) {
const processedReq = {
...req,
params: {
...req.params,
},
};
if (processedReq.params.url != null) {
processedReq.params.url = processedReq.params.url.replace(
"localhost",
debuggerInfo.originalSourceURLAddress
const {
debuggerRelativeBaseUrl,
originalSourceURLOrigin,
prependedFilePrefix,
} = debuggerInfo;
const processedReq = {
...req,
params: {
...req.params,
},
};
if (originalSourceURLOrigin != null && processedReq.params.url != null) {
processedReq.params.url = processedReq.params.url.replace(
debuggerRelativeBaseUrl.origin,
originalSourceURLOrigin
);
if (
processedReq.params.url &&
processedReq.params.url.startsWith(FILE_PREFIX) &&
prependedFilePrefix
) {
processedReq.params.url = processedReq.params.url.slice(
FILE_PREFIX.length
);
if (
processedReq.params.url &&
processedReq.params.url.startsWith(FILE_PREFIX) &&
debuggerInfo.prependedFilePrefix
) {
processedReq.params.url = processedReq.params.url.slice(
FILE_PREFIX.length
);
}
}
if (processedReq.params.urlRegex != null) {
processedReq.params.urlRegex = processedReq.params.urlRegex.replace(
/localhost/g,
debuggerInfo.originalSourceURLAddress
);
}
return processedReq;
}
return req;
if (
REWRITE_HOSTS_TO_LOCALHOST.has(this.#deviceRelativeBaseUrl.hostname) &&
this.#deviceRelativeBaseUrl.port === debuggerRelativeBaseUrl.port &&
debuggerRelativeBaseUrl.hostname === "localhost" &&
processedReq.params.urlRegex != null
) {
processedReq.params.urlRegex = processedReq.params.urlRegex.replaceAll(
"localhost",
this.#deviceRelativeBaseUrl.hostname.replaceAll(".", "\\.")
);
}
return processedReq;
}

@@ -663,0 +681,0 @@ #processDebuggerGetScriptSource(req, socket) {

@@ -193,2 +193,4 @@ "use strict";

const pageId = query.page;
const debuggerRelativeBaseUrl =
(0, _getBaseUrlFromRequest.default)(req) ?? this.#serverBaseUrl;
if (deviceId == null || pageId == null) {

@@ -203,2 +205,3 @@ throw new Error("Incorrect URL - must provide device and page IDs");

device.handleDebuggerConnection(socket, pageId, {
debuggerRelativeBaseUrl,
userAgent: req.headers["user-agent"] ?? query.userAgent ?? null,

@@ -205,0 +208,0 @@ });

{
"name": "@react-native/dev-middleware",
"version": "0.77.0-nightly-20241121-550b0c0ed",
"version": "0.77.0-nightly-20241122-e4d8c9678",
"description": "Dev server middleware for React Native",

@@ -26,3 +26,3 @@ "keywords": [

"@isaacs/ttlcache": "^1.4.1",
"@react-native/debugger-frontend": "0.77.0-nightly-20241121-550b0c0ed",
"@react-native/debugger-frontend": "0.77.0-nightly-20241122-e4d8c9678",
"chrome-launcher": "^0.15.2",

@@ -29,0 +29,0 @@ "chromium-edge-launcher": "^0.2.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc