@react-native/dev-middleware 0.85.0-nightly-20260206-d494510ce → 0.85.0-nightly-20260208-0dd9e73be

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ function myDevServerImpl(args) {
16
16
 
17
17
  const {middleware, websocketEndpoints} = createDevMiddleware({
18
18
  projectRoot: metroConfig.projectRoot,
19
- serverBaseUrl: `http://${args.host}:${args.port}`,
19
+ serverBaseUrl: new URL(`http://${args.host}:${args.port}`),
20
20
  logger,
21
21
  });
22
22
 
@@ -13,13 +13,14 @@ import type { BrowserLauncher } from "./types/BrowserLauncher";
13
13
  import type { EventReporter } from "./types/EventReporter";
14
14
  import type { ExperimentsConfig } from "./types/Experiments";
15
15
  import type { Logger } from "./types/Logger";
16
+ import type { ReadonlyURL } from "./types/ReadonlyURL";
16
17
  import type { NextHandleFunction } from "connect";
17
18
  type Options = Readonly<{
18
19
  /**
19
20
  * The base URL to the dev server, as reachable from the machine on which
20
21
  * dev-middleware is hosted. Typically `http://localhost:${metroPort}`.
21
22
  */
22
- serverBaseUrl: string;
23
+ serverBaseUrl: string | ReadonlyURL;
23
24
  logger?: Logger;
24
25
  /**
25
26
  * An interface for integrators to provide a custom implementation for
@@ -31,6 +31,7 @@ function createDevMiddleware({
31
31
  unstable_customInspectorMessageHandler,
32
32
  unstable_trackInspectorProxyEventLoopPerf = false,
33
33
  }) {
34
+ const normalizedServerBaseUrl = new URL(serverBaseUrl);
34
35
  const experiments = getExperiments(experimentConfig);
35
36
  const eventReporter = createWrappedEventReporter(
36
37
  unstable_eventReporter,
@@ -38,7 +39,7 @@ function createDevMiddleware({
38
39
  experiments,
39
40
  );
40
41
  const inspectorProxy = new _InspectorProxy.default(
41
- serverBaseUrl,
42
+ normalizedServerBaseUrl,
42
43
  eventReporter,
43
44
  experiments,
44
45
  logger,
@@ -49,7 +50,7 @@ function createDevMiddleware({
49
50
  .use(
50
51
  "/open-debugger",
51
52
  (0, _openDebuggerMiddleware.default)({
52
- serverBaseUrl,
53
+ serverBaseUrl: normalizedServerBaseUrl,
53
54
  inspectorProxy,
54
55
  browserLauncher: unstable_browserLauncher,
55
56
  eventReporter,
@@ -13,6 +13,7 @@ import type { BrowserLauncher } from "./types/BrowserLauncher";
13
13
  import type { EventReporter } from "./types/EventReporter";
14
14
  import type { ExperimentsConfig } from "./types/Experiments";
15
15
  import type { Logger } from "./types/Logger";
16
+ import type { ReadonlyURL } from "./types/ReadonlyURL";
16
17
  import type { NextHandleFunction } from "connect";
17
18
 
18
19
  type Options = Readonly<{
@@ -20,7 +21,7 @@ type Options = Readonly<{
20
21
  * The base URL to the dev server, as reachable from the machine on which
21
22
  * dev-middleware is hosted. Typically `http://localhost:${metroPort}`.
22
23
  */
23
- serverBaseUrl: string,
24
+ serverBaseUrl: string | ReadonlyURL,
24
25
 
25
26
  logger?: Logger,
26
27
 
package/dist/index.d.ts CHANGED
@@ -19,5 +19,6 @@ export type {
19
19
  CreateCustomMessageHandlerFn,
20
20
  } from "./inspector-proxy/CustomMessageHandler";
21
21
  export type { Logger } from "./types/Logger";
22
+ export type { ReadonlyURL } from "./types/ReadonlyURL";
22
23
  export { default as unstable_DefaultBrowserLauncher } from "./utils/DefaultBrowserLauncher";
23
24
  export { default as createDevMiddleware } from "./createDevMiddleware";
@@ -19,6 +19,7 @@ export type {
19
19
  CreateCustomMessageHandlerFn,
20
20
  } from "./inspector-proxy/CustomMessageHandler";
21
21
  export type { Logger } from "./types/Logger";
22
+ export type { ReadonlyURL } from "./types/ReadonlyURL";
22
23
 
23
24
  export { default as unstable_DefaultBrowserLauncher } from "./utils/DefaultBrowserLauncher";
24
25
  export { default as createDevMiddleware } from "./createDevMiddleware";
@@ -10,6 +10,7 @@
10
10
 
11
11
  import type { EventReporter } from "../types/EventReporter";
12
12
  import type { Experiments } from "../types/Experiments";
13
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
13
14
  import type { CreateCustomMessageHandlerFn } from "./CustomMessageHandler";
14
15
  import type { Page } from "./types";
15
16
  import WS from "ws";
@@ -27,8 +28,8 @@ export type DeviceOptions = Readonly<{
27
28
  socket: WS;
28
29
  eventReporter: null | undefined | EventReporter;
29
30
  createMessageMiddleware: null | undefined | CreateCustomMessageHandlerFn;
30
- deviceRelativeBaseUrl: URL;
31
- serverRelativeBaseUrl: URL;
31
+ deviceRelativeBaseUrl: ReadonlyURL;
32
+ serverRelativeBaseUrl: ReadonlyURL;
32
33
  isProfilingBuild: boolean;
33
34
  experiments: Experiments;
34
35
  }>;
@@ -55,7 +56,7 @@ declare class Device {
55
56
  socket: WS,
56
57
  pageId: string,
57
58
  $$PARAM_2$$: Readonly<{
58
- debuggerRelativeBaseUrl: URL;
59
+ debuggerRelativeBaseUrl: ReadonlyURL;
59
60
  userAgent: string | null;
60
61
  }>,
61
62
  ): void;
@@ -10,6 +10,7 @@
10
10
 
11
11
  import type { EventReporter } from "../types/EventReporter";
12
12
  import type { Experiments } from "../types/Experiments";
13
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
13
14
  import type { CreateCustomMessageHandlerFn } from "./CustomMessageHandler";
14
15
  import type { Page } from "./types";
15
16
 
@@ -31,8 +32,8 @@ export type DeviceOptions = Readonly<{
31
32
  socket: WS,
32
33
  eventReporter: ?EventReporter,
33
34
  createMessageMiddleware: ?CreateCustomMessageHandlerFn,
34
- deviceRelativeBaseUrl: URL,
35
- serverRelativeBaseUrl: URL,
35
+ deviceRelativeBaseUrl: ReadonlyURL,
36
+ serverRelativeBaseUrl: ReadonlyURL,
36
37
  isProfilingBuild: boolean,
37
38
  experiments: Experiments,
38
39
  }>;
@@ -64,7 +65,7 @@ declare export default class Device {
64
65
  socket: WS,
65
66
  pageId: string,
66
67
  $$PARAM_2$$: Readonly<{
67
- debuggerRelativeBaseUrl: URL,
68
+ debuggerRelativeBaseUrl: ReadonlyURL,
68
69
  userAgent: string | null,
69
70
  }>,
70
71
  ): void;
@@ -11,12 +11,13 @@
11
11
  import type { EventReporter } from "../types/EventReporter";
12
12
  import type { Experiments } from "../types/Experiments";
13
13
  import type { Logger } from "../types/Logger";
14
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
14
15
  import type { CreateCustomMessageHandlerFn } from "./CustomMessageHandler";
15
16
  import type { PageDescription } from "./types";
16
17
  import type { IncomingMessage, ServerResponse } from "http";
17
18
  import WS from "ws";
18
19
  export type GetPageDescriptionsConfig = {
19
- requestorRelativeBaseUrl: URL;
20
+ requestorRelativeBaseUrl: ReadonlyURL;
20
21
  logNoPagesForConnectedDevice?: boolean;
21
22
  };
22
23
  export interface InspectorProxyQueries {
@@ -33,7 +34,7 @@ export interface InspectorProxyQueries {
33
34
  */
34
35
  declare class InspectorProxy implements InspectorProxyQueries {
35
36
  constructor(
36
- serverBaseUrl: string,
37
+ serverBaseUrl: ReadonlyURL,
37
38
  eventReporter: null | undefined | EventReporter,
38
39
  experiments: Experiments,
39
40
  logger?: Logger,
@@ -64,7 +64,7 @@ class InspectorProxy {
64
64
  customMessageHandler,
65
65
  trackEventLoopPerf = false,
66
66
  ) {
67
- this.#serverBaseUrl = new URL(serverBaseUrl);
67
+ this.#serverBaseUrl = serverBaseUrl;
68
68
  this.#devices = new Map();
69
69
  this.#eventReporter = eventReporter;
70
70
  this.#experiments = experiments;
@@ -180,7 +180,7 @@ class InspectorProxy {
180
180
  const devtoolsFrontendUrl = (0, _getDevToolsFrontendUrl.default)(
181
181
  this.#experiments,
182
182
  webSocketDebuggerUrl,
183
- this.#serverBaseUrl.origin,
183
+ new URL(this.#serverBaseUrl),
184
184
  {
185
185
  relative: true,
186
186
  useFuseboxEntryPoint: page.capabilities.prefersFuseboxFrontend,
@@ -11,6 +11,7 @@
11
11
  import type { EventReporter } from "../types/EventReporter";
12
12
  import type { Experiments } from "../types/Experiments";
13
13
  import type { Logger } from "../types/Logger";
14
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
14
15
  import type { CreateCustomMessageHandlerFn } from "./CustomMessageHandler";
15
16
  import type { PageDescription } from "./types";
16
17
  import type { IncomingMessage, ServerResponse } from "http";
@@ -18,7 +19,7 @@ import type { IncomingMessage, ServerResponse } from "http";
18
19
  import WS from "ws";
19
20
 
20
21
  export type GetPageDescriptionsConfig = {
21
- requestorRelativeBaseUrl: URL,
22
+ requestorRelativeBaseUrl: ReadonlyURL,
22
23
  logNoPagesForConnectedDevice?: boolean,
23
24
  };
24
25
 
@@ -37,7 +38,7 @@ export interface InspectorProxyQueries {
37
38
  */
38
39
  declare export default class InspectorProxy implements InspectorProxyQueries {
39
40
  constructor(
40
- serverBaseUrl: string,
41
+ serverBaseUrl: ReadonlyURL,
41
42
  eventReporter: ?EventReporter,
42
43
  experiments: Experiments,
43
44
  logger?: Logger,
@@ -13,9 +13,10 @@ import type { BrowserLauncher } from "../types/BrowserLauncher";
13
13
  import type { EventReporter } from "../types/EventReporter";
14
14
  import type { Experiments } from "../types/Experiments";
15
15
  import type { Logger } from "../types/Logger";
16
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
16
17
  import type { NextHandleFunction } from "connect";
17
18
  type Options = Readonly<{
18
- serverBaseUrl: string;
19
+ serverBaseUrl: ReadonlyURL;
19
20
  logger?: Logger;
20
21
  browserLauncher: BrowserLauncher;
21
22
  eventReporter?: EventReporter;
@@ -45,7 +45,7 @@ function openDebuggerMiddleware({
45
45
  const query = Object.fromEntries(searchParams);
46
46
  const targets = inspectorProxy
47
47
  .getPageDescriptions({
48
- requestorRelativeBaseUrl: new URL(serverBaseUrl),
48
+ requestorRelativeBaseUrl: serverBaseUrl,
49
49
  })
50
50
  .filter((app) => {
51
51
  const betterReloadingSupport =
@@ -110,7 +110,7 @@ function openDebuggerMiddleware({
110
110
  const frontendUrl = (0, _getDevToolsFrontendUrl.default)(
111
111
  experiments,
112
112
  target.webSocketDebuggerUrl,
113
- serverBaseUrl,
113
+ new URL(serverBaseUrl),
114
114
  {
115
115
  launchId: query.launchId,
116
116
  telemetryInfo: query.telemetryInfo,
@@ -168,7 +168,7 @@ function openDebuggerMiddleware({
168
168
  Location: (0, _getDevToolsFrontendUrl.default)(
169
169
  experiments,
170
170
  target.webSocketDebuggerUrl,
171
- serverBaseUrl,
171
+ new URL(serverBaseUrl),
172
172
  {
173
173
  relative: true,
174
174
  launchId: query.launchId,
@@ -13,9 +13,10 @@ import type { BrowserLauncher } from "../types/BrowserLauncher";
13
13
  import type { EventReporter } from "../types/EventReporter";
14
14
  import type { Experiments } from "../types/Experiments";
15
15
  import type { Logger } from "../types/Logger";
16
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
16
17
  import type { NextHandleFunction } from "connect";
17
18
  type Options = Readonly<{
18
- serverBaseUrl: string,
19
+ serverBaseUrl: ReadonlyURL,
19
20
  logger?: Logger,
20
21
  browserLauncher: BrowserLauncher,
21
22
  eventReporter?: EventReporter,
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ * @format
9
+ */
10
+
11
+ /**
12
+ * A readonly view of URLSearchParams that only exposes read operations.
13
+ */
14
+ export interface ReadonlyURLSearchParams {
15
+ get(name: string): string | null;
16
+ getAll(name: string): Array<string>;
17
+ has(name: string, value?: string): boolean;
18
+ readonly size: number;
19
+ entries(): Iterator<[string, string]>;
20
+ keys(): Iterator<string>;
21
+ values(): Iterator<string>;
22
+ forEach<This>(
23
+ callback: (
24
+ this: This,
25
+ value: string,
26
+ name: string,
27
+ params: URLSearchParams,
28
+ ) => unknown,
29
+ thisArg: This,
30
+ ): void;
31
+ toString(): string;
32
+ @@iterator(): Iterator<[string, string]>;
33
+ }
34
+ /**
35
+ * A readonly view of URL that prevents mutation of URL properties.
36
+ * Used for URLs passed between module boundaries.
37
+ */
38
+ export interface ReadonlyURL {
39
+ readonly hash: string;
40
+ readonly host: string;
41
+ readonly hostname: string;
42
+ readonly href: string;
43
+ readonly origin: string;
44
+ readonly password: string;
45
+ readonly pathname: string;
46
+ readonly port: string;
47
+ readonly protocol: string;
48
+ readonly search: string;
49
+ readonly searchParams: ReadonlyURLSearchParams;
50
+ readonly username: string;
51
+ toString(): string;
52
+ toJSON(): string;
53
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ /**
12
+ * A readonly view of URLSearchParams that only exposes read operations.
13
+ */
14
+ export interface ReadonlyURLSearchParams {
15
+ get(name: string): string | null;
16
+ getAll(name: string): Array<string>;
17
+ has(name: string, value?: string): boolean;
18
+ +size: number;
19
+ entries(): Iterator<[string, string]>;
20
+ keys(): Iterator<string>;
21
+ values(): Iterator<string>;
22
+ forEach<This>(
23
+ callback: (
24
+ this: This,
25
+ value: string,
26
+ name: string,
27
+ params: URLSearchParams,
28
+ ) => mixed,
29
+ thisArg: This,
30
+ ): void;
31
+ toString(): string;
32
+ @@iterator(): Iterator<[string, string]>;
33
+ }
34
+
35
+ /**
36
+ * A readonly view of URL that prevents mutation of URL properties.
37
+ * Used for URLs passed between module boundaries.
38
+ */
39
+ export interface ReadonlyURL {
40
+ +hash: string;
41
+ +host: string;
42
+ +hostname: string;
43
+ +href: string;
44
+ +origin: string;
45
+ +password: string;
46
+ +pathname: string;
47
+ +port: string;
48
+ +protocol: string;
49
+ +search: string;
50
+ +searchParams: ReadonlyURLSearchParams;
51
+ +username: string;
52
+ toString(): string;
53
+ toJSON(): string;
54
+ }
@@ -9,13 +9,14 @@
9
9
  */
10
10
 
11
11
  import type { Experiments } from "../types/Experiments";
12
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
12
13
  /**
13
14
  * Get the DevTools frontend URL to debug a given React Native CDP target.
14
15
  */
15
16
  declare function getDevToolsFrontendUrl(
16
17
  experiments: Experiments,
17
18
  webSocketDebuggerUrl: string,
18
- devServerUrl: string,
19
+ devServerUrl: ReadonlyURL,
19
20
  options?: Readonly<{
20
21
  relative?: boolean;
21
22
  launchId?: string;
@@ -15,7 +15,7 @@ function getDevToolsFrontendUrl(
15
15
  devServerUrl,
16
16
  });
17
17
  const appUrl =
18
- (options?.relative === true ? "" : devServerUrl) +
18
+ (options?.relative === true ? "" : devServerUrl.origin) +
19
19
  "/debugger-frontend/" +
20
20
  (options?.useFuseboxEntryPoint === true
21
21
  ? "rn_fusebox.html"
@@ -43,7 +43,7 @@ function getDevToolsFrontendUrl(
43
43
  }
44
44
  function getWsParam({ webSocketDebuggerUrl, devServerUrl }) {
45
45
  const wsUrl = new URL(webSocketDebuggerUrl);
46
- const serverHost = new URL(devServerUrl).host;
46
+ const serverHost = devServerUrl.host;
47
47
  let value;
48
48
  if (wsUrl.host === serverHost) {
49
49
  value = wsUrl.pathname + wsUrl.search + wsUrl.hash;
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type { Experiments } from "../types/Experiments";
12
+ import type { ReadonlyURL } from "../types/ReadonlyURL";
12
13
 
13
14
  /**
14
15
  * Get the DevTools frontend URL to debug a given React Native CDP target.
@@ -16,7 +17,7 @@ import type { Experiments } from "../types/Experiments";
16
17
  declare export default function getDevToolsFrontendUrl(
17
18
  experiments: Experiments,
18
19
  webSocketDebuggerUrl: string,
19
- devServerUrl: string,
20
+ devServerUrl: ReadonlyURL,
20
21
  options?: Readonly<{
21
22
  relative?: boolean,
22
23
  launchId?: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/dev-middleware",
3
- "version": "0.85.0-nightly-20260206-d494510ce",
3
+ "version": "0.85.0-nightly-20260208-0dd9e73be",
4
4
  "description": "Dev server middleware for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@isaacs/ttlcache": "^1.4.1",
29
- "@react-native/debugger-frontend": "0.85.0-nightly-20260206-d494510ce",
30
- "@react-native/debugger-shell": "0.85.0-nightly-20260206-d494510ce",
29
+ "@react-native/debugger-frontend": "0.85.0-nightly-20260208-0dd9e73be",
30
+ "@react-native/debugger-shell": "0.85.0-nightly-20260208-0dd9e73be",
31
31
  "chrome-launcher": "^0.15.2",
32
32
  "chromium-edge-launcher": "^0.3.0",
33
33
  "connect": "^3.6.5",
@@ -39,7 +39,7 @@
39
39
  "ws": "^7.5.10"
40
40
  },
41
41
  "devDependencies": {
42
- "@react-native/debugger-shell": "0.85.0-nightly-20260206-d494510ce",
42
+ "@react-native/debugger-shell": "0.85.0-nightly-20260208-0dd9e73be",
43
43
  "selfsigned": "^4.0.0",
44
44
  "undici": "^5.29.0",
45
45
  "wait-for-expect": "^3.0.2"