@depup/react-native__dev-middleware 0.84.1-depup.1 → 0.85.0-depup.0

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.
Files changed (44) hide show
  1. package/README.md +3 -4
  2. package/changes.json +2 -6
  3. package/dist/createDevMiddleware.d.ts +18 -9
  4. package/dist/createDevMiddleware.js +7 -17
  5. package/dist/createDevMiddleware.js.flow +21 -12
  6. package/dist/index.d.ts +4 -3
  7. package/dist/index.js +4 -4
  8. package/dist/index.js.flow +4 -3
  9. package/dist/inspector-proxy/CustomMessageHandler.js.flow +3 -3
  10. package/dist/inspector-proxy/Device.d.ts +6 -3
  11. package/dist/inspector-proxy/Device.js +197 -161
  12. package/dist/inspector-proxy/Device.js.flow +9 -6
  13. package/dist/inspector-proxy/DeviceEventReporter.d.ts +0 -3
  14. package/dist/inspector-proxy/DeviceEventReporter.js +0 -10
  15. package/dist/inspector-proxy/DeviceEventReporter.js.flow +5 -8
  16. package/dist/inspector-proxy/InspectorProxy.d.ts +3 -2
  17. package/dist/inspector-proxy/InspectorProxy.js +47 -15
  18. package/dist/inspector-proxy/InspectorProxy.js.flow +3 -2
  19. package/dist/inspector-proxy/__docs__/README.md +324 -0
  20. package/dist/inspector-proxy/cdp-types/messages.js.flow +3 -3
  21. package/dist/inspector-proxy/types.d.ts +24 -9
  22. package/dist/inspector-proxy/types.js.flow +36 -22
  23. package/dist/middleware/openDebuggerMiddleware.d.ts +4 -6
  24. package/dist/middleware/openDebuggerMiddleware.js +12 -22
  25. package/dist/middleware/openDebuggerMiddleware.js.flow +5 -7
  26. package/dist/types/{BrowserLauncher.js.flow → DevToolLauncher.d.ts} +10 -13
  27. package/dist/types/{BrowserLauncher.d.ts → DevToolLauncher.js.flow} +14 -12
  28. package/dist/types/EventReporter.d.ts +24 -27
  29. package/dist/types/EventReporter.js.flow +1 -7
  30. package/dist/types/Experiments.d.ts +8 -4
  31. package/dist/types/Experiments.js.flow +9 -5
  32. package/dist/types/Logger.js.flow +1 -1
  33. package/dist/types/ReadonlyURL.d.ts +53 -0
  34. package/dist/types/ReadonlyURL.js +1 -0
  35. package/dist/types/ReadonlyURL.js.flow +54 -0
  36. package/dist/utils/{DefaultBrowserLauncher.d.ts → DefaultToolLauncher.d.ts} +7 -11
  37. package/dist/utils/{DefaultBrowserLauncher.js → DefaultToolLauncher.js} +21 -4
  38. package/dist/utils/DefaultToolLauncher.js.flow +25 -0
  39. package/dist/utils/getDevToolsFrontendUrl.d.ts +2 -3
  40. package/dist/utils/getDevToolsFrontendUrl.js +3 -6
  41. package/dist/utils/getDevToolsFrontendUrl.js.flow +3 -4
  42. package/package.json +10 -14
  43. package/dist/utils/DefaultBrowserLauncher.js.flow +0 -29
  44. /package/dist/types/{BrowserLauncher.js → DevToolLauncher.js} +0 -0
@@ -12,7 +12,7 @@ export type Experiments = Readonly<{
12
12
  /**
13
13
  * Enables the handling of GET requests in the /open-debugger endpoint,
14
14
  * in addition to POST requests. GET requests respond by redirecting to
15
- * the debugger frontend, instead of opening it using the BrowserLauncher
15
+ * the debugger frontend, instead of opening it using the DevToolLauncher
16
16
  * interface.
17
17
  */
18
18
  enableOpenDebuggerRedirect: boolean;
@@ -21,9 +21,13 @@ export type Experiments = Readonly<{
21
21
  */
22
22
  enableNetworkInspector: boolean;
23
23
  /**
24
- * Launch the Fusebox frontend in a standalone shell instead of a browser.
25
- * When this is enabled, we will use the optional unstable_showFuseboxShell
26
- * method on the BrowserLauncher, or throw an error if the method is missing.
24
+ * Launch the debugger frontend in a standalone shell instead of a browser.
25
+ * When this is enabled, we will use the optional launchDebuggerShell
26
+ * method on the DevToolLauncher, or throw an error if the method is missing.
27
+ *
28
+ * NOTE: Disabling this also disables support for concurrent sessions in the
29
+ * inspector proxy. Without the standalone shell, the proxy remains responsible
30
+ * for keeping only one debugger frontend active at a time per page.
27
31
  */
28
32
  enableStandaloneFuseboxShell: boolean;
29
33
  }>;
@@ -8,11 +8,11 @@
8
8
  * @format
9
9
  */
10
10
 
11
- export type Experiments = $ReadOnly<{
11
+ export type Experiments = Readonly<{
12
12
  /**
13
13
  * Enables the handling of GET requests in the /open-debugger endpoint,
14
14
  * in addition to POST requests. GET requests respond by redirecting to
15
- * the debugger frontend, instead of opening it using the BrowserLauncher
15
+ * the debugger frontend, instead of opening it using the DevToolLauncher
16
16
  * interface.
17
17
  */
18
18
  enableOpenDebuggerRedirect: boolean,
@@ -24,9 +24,13 @@ export type Experiments = $ReadOnly<{
24
24
  enableNetworkInspector: boolean,
25
25
 
26
26
  /**
27
- * Launch the Fusebox frontend in a standalone shell instead of a browser.
28
- * When this is enabled, we will use the optional unstable_showFuseboxShell
29
- * method on the BrowserLauncher, or throw an error if the method is missing.
27
+ * Launch the debugger frontend in a standalone shell instead of a browser.
28
+ * When this is enabled, we will use the optional launchDebuggerShell
29
+ * method on the DevToolLauncher, or throw an error if the method is missing.
30
+ *
31
+ * NOTE: Disabling this also disables support for concurrent sessions in the
32
+ * inspector proxy. Without the standalone shell, the proxy remains responsible
33
+ * for keeping only one debugger frontend active at a time per page.
30
34
  */
31
35
  enableStandaloneFuseboxShell: boolean,
32
36
  }>;
@@ -8,7 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- export type Logger = $ReadOnly<{
11
+ export type Logger = Readonly<{
12
12
  error: (...message: Array<string>) => void,
13
13
  info: (...message: Array<string>) => void,
14
14
  warn: (...message: Array<string>) => void,
@@ -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
+ }
@@ -8,23 +8,19 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type { DebuggerShellPreparationResult } from "../";
11
+ import type { DebuggerShellPreparationResult } from "../types/DevToolLauncher";
12
12
  /**
13
- * Default `BrowserLauncher` implementation which opens URLs on the host
14
- * machine.
13
+ * Default `DevToolLauncher` implementation which handles opening apps on the
14
+ * local machine.
15
15
  */
16
- declare const DefaultBrowserLauncher: {
17
- /**
18
- * Attempt to open the debugger frontend in a Google Chrome or Microsoft Edge
19
- * app window.
20
- */
16
+ declare const DefaultToolLauncher: {
21
17
  launchDebuggerAppWindow: (url: string) => Promise<void>;
22
- unstable_showFuseboxShell(url: string, windowKey: string): Promise<void>;
23
- unstable_prepareFuseboxShell(
18
+ launchDebuggerShell(url: string, windowKey: string): Promise<void>;
19
+ prepareDebuggerShell(
24
20
  prebuiltBinaryPath?: null | undefined | string,
25
21
  ): Promise<DebuggerShellPreparationResult>;
26
22
  };
27
- declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof DefaultBrowserLauncher;
23
+ declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof DefaultToolLauncher;
28
24
  declare type $$EXPORT_DEFAULT_DECLARATION$$ =
29
25
  typeof $$EXPORT_DEFAULT_DECLARATION$$;
30
26
  export default $$EXPORT_DEFAULT_DECLARATION$$;
@@ -12,8 +12,11 @@ const { spawn } = require("child_process");
12
12
  const ChromeLauncher = require("chrome-launcher");
13
13
  const { Launcher: EdgeLauncher } = require("chromium-edge-launcher");
14
14
  const open = require("open");
15
- const DefaultBrowserLauncher = {
15
+ const DefaultToolLauncher = {
16
16
  launchDebuggerAppWindow: async (url) => {
17
+ if (process.env.NODE_ENV === "test") {
18
+ assertMockedInTests();
19
+ }
17
20
  let chromePath;
18
21
  try {
19
22
  chromePath = ChromeLauncher.getChromePath();
@@ -44,14 +47,28 @@ const DefaultBrowserLauncher = {
44
47
  });
45
48
  });
46
49
  },
47
- async unstable_showFuseboxShell(url, windowKey) {
50
+ async launchDebuggerShell(url, windowKey) {
51
+ if (process.env.NODE_ENV === "test") {
52
+ assertMockedInTests();
53
+ }
48
54
  return await unstable_spawnDebuggerShellWithArgs([
49
55
  "--frontendUrl=" + url,
50
56
  "--windowKey=" + windowKey,
51
57
  ]);
52
58
  },
53
- async unstable_prepareFuseboxShell(prebuiltBinaryPath) {
59
+ async prepareDebuggerShell(prebuiltBinaryPath) {
60
+ if (process.env.NODE_ENV === "test") {
61
+ assertMockedInTests();
62
+ }
54
63
  return await unstable_prepareDebuggerShell();
55
64
  },
56
65
  };
57
- var _default = (exports.default = DefaultBrowserLauncher);
66
+ function assertMockedInTests() {
67
+ if (process.env.NODE_ENV === "test") {
68
+ throw new Error(
69
+ "DefaultToolLauncher must be mocked or overridden in tests. " +
70
+ "Add jest.mock('../utils/DefaultAppLauncher') to test setup.",
71
+ );
72
+ }
73
+ }
74
+ var _default = (exports.default = DefaultToolLauncher);
@@ -0,0 +1,25 @@
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
+ import type { DebuggerShellPreparationResult } from "../types/DevToolLauncher";
12
+
13
+ /**
14
+ * Default `DevToolLauncher` implementation which handles opening apps on the
15
+ * local machine.
16
+ */
17
+ declare const DefaultToolLauncher: {
18
+ launchDebuggerAppWindow: (url: string) => Promise<void>,
19
+ launchDebuggerShell(url: string, windowKey: string): Promise<void>,
20
+ prepareDebuggerShell(
21
+ prebuiltBinaryPath?: ?string,
22
+ ): Promise<DebuggerShellPreparationResult>,
23
+ };
24
+
25
+ declare export default typeof DefaultToolLauncher;
@@ -9,19 +9,18 @@
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;
22
23
  telemetryInfo?: string;
23
- /** Whether to use the modern `rn_fusebox.html` entry point. */
24
- useFuseboxEntryPoint?: boolean;
25
24
  appId?: string;
26
25
  panel?: string;
27
26
  }>,
@@ -15,11 +15,8 @@ function getDevToolsFrontendUrl(
15
15
  devServerUrl,
16
16
  });
17
17
  const appUrl =
18
- (options?.relative === true ? "" : devServerUrl) +
19
- "/debugger-frontend/" +
20
- (options?.useFuseboxEntryPoint === true
21
- ? "rn_fusebox.html"
22
- : "rn_inspector.html");
18
+ (options?.relative === true ? "" : devServerUrl.origin) +
19
+ "/debugger-frontend/rn_fusebox.html";
23
20
  const searchParams = new URLSearchParams([
24
21
  [wsParam.key, wsParam.value],
25
22
  ["sources.hide_add_folder", "true"],
@@ -43,7 +40,7 @@ function getDevToolsFrontendUrl(
43
40
  }
44
41
  function getWsParam({ webSocketDebuggerUrl, devServerUrl }) {
45
42
  const wsUrl = new URL(webSocketDebuggerUrl);
46
- const serverHost = new URL(devServerUrl).host;
43
+ const serverHost = devServerUrl.host;
47
44
  let value;
48
45
  if (wsUrl.host === serverHost) {
49
46
  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,13 +17,11 @@ 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
- options?: $ReadOnly<{
20
+ devServerUrl: ReadonlyURL,
21
+ options?: Readonly<{
21
22
  relative?: boolean,
22
23
  launchId?: string,
23
24
  telemetryInfo?: string,
24
- /** Whether to use the modern `rn_fusebox.html` entry point. */
25
- useFuseboxEntryPoint?: boolean,
26
25
  appId?: string,
27
26
  panel?: string,
28
27
  }>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/react-native__dev-middleware",
3
- "version": "0.84.1-depup.1",
3
+ "version": "0.85.0-depup.0",
4
4
  "description": "Dev server middleware for React Native (with updated dependencies)",
5
5
  "keywords": [
6
6
  "@react-native/dev-middleware",
@@ -32,8 +32,8 @@
32
32
  "scripts": {},
33
33
  "dependencies": {
34
34
  "@isaacs/ttlcache": "^2.1.4",
35
- "@react-native/debugger-frontend": "0.84.1",
36
- "@react-native/debugger-shell": "0.84.1",
35
+ "@react-native/debugger-frontend": "0.85.0",
36
+ "@react-native/debugger-shell": "0.85.0",
37
37
  "chrome-launcher": "^1.2.1",
38
38
  "chromium-edge-launcher": "^0.3.0",
39
39
  "connect": "^3.7.0",
@@ -45,13 +45,13 @@
45
45
  "ws": "^8.20.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@react-native/debugger-shell": "0.84.1",
49
- "selfsigned": "^4.0.0",
50
- "undici": "^5.29.0",
48
+ "@react-native/debugger-shell": "0.85.0",
49
+ "selfsigned": "^5.5.0",
50
+ "undici": "^6.23.0",
51
51
  "wait-for-expect": "^3.0.2"
52
52
  },
53
53
  "engines": {
54
- "node": ">= 20.19.4"
54
+ "node": "^20.19.4 || ^22.13.0 || ^24.3.0 || >= 25.0.0"
55
55
  },
56
56
  "depup": {
57
57
  "changes": {
@@ -63,10 +63,6 @@
63
63
  "from": "^0.15.2",
64
64
  "to": "^1.2.1"
65
65
  },
66
- "chromium-edge-launcher": {
67
- "from": "^0.2.0",
68
- "to": "^0.3.0"
69
- },
70
66
  "connect": {
71
67
  "from": "^3.6.5",
72
68
  "to": "^3.7.0"
@@ -88,10 +84,10 @@
88
84
  "to": "^8.20.0"
89
85
  }
90
86
  },
91
- "depsUpdated": 8,
87
+ "depsUpdated": 7,
92
88
  "originalPackage": "@react-native/dev-middleware",
93
- "originalVersion": "0.84.1",
94
- "processedAt": "2026-03-21T20:09:20.467Z",
89
+ "originalVersion": "0.85.0",
90
+ "processedAt": "2026-04-07T16:27:44.720Z",
95
91
  "smokeTest": "failed"
96
92
  }
97
93
  }
@@ -1,29 +0,0 @@
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
- import type { DebuggerShellPreparationResult } from "../";
12
-
13
- /**
14
- * Default `BrowserLauncher` implementation which opens URLs on the host
15
- * machine.
16
- */
17
- declare const DefaultBrowserLauncher: {
18
- /**
19
- * Attempt to open the debugger frontend in a Google Chrome or Microsoft Edge
20
- * app window.
21
- */
22
- launchDebuggerAppWindow: (url: string) => Promise<void>,
23
- unstable_showFuseboxShell(url: string, windowKey: string): Promise<void>,
24
- unstable_prepareFuseboxShell(
25
- prebuiltBinaryPath?: ?string,
26
- ): Promise<DebuggerShellPreparationResult>,
27
- };
28
-
29
- declare export default typeof DefaultBrowserLauncher;