@depup/react-native__dev-middleware 0.84.1-depup.1

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 (63) hide show
  1. package/README.md +38 -0
  2. package/changes.json +38 -0
  3. package/dist/createDevMiddleware.d.ts +62 -0
  4. package/dist/createDevMiddleware.js +140 -0
  5. package/dist/createDevMiddleware.js.flow +72 -0
  6. package/dist/index.d.ts +23 -0
  7. package/dist/index.js +26 -0
  8. package/dist/index.js.flow +24 -0
  9. package/dist/inspector-proxy/CdpDebugLogging.d.ts +20 -0
  10. package/dist/inspector-proxy/CdpDebugLogging.js +117 -0
  11. package/dist/inspector-proxy/CdpDebugLogging.js.flow +20 -0
  12. package/dist/inspector-proxy/CustomMessageHandler.d.ts +48 -0
  13. package/dist/inspector-proxy/CustomMessageHandler.js +1 -0
  14. package/dist/inspector-proxy/CustomMessageHandler.js.flow +54 -0
  15. package/dist/inspector-proxy/Device.d.ts +62 -0
  16. package/dist/inspector-proxy/Device.js +810 -0
  17. package/dist/inspector-proxy/Device.js.flow +70 -0
  18. package/dist/inspector-proxy/DeviceEventReporter.d.ts +54 -0
  19. package/dist/inspector-proxy/DeviceEventReporter.js +194 -0
  20. package/dist/inspector-proxy/DeviceEventReporter.js.flow +62 -0
  21. package/dist/inspector-proxy/EventLoopPerfTracker.d.ts +31 -0
  22. package/dist/inspector-proxy/EventLoopPerfTracker.js +50 -0
  23. package/dist/inspector-proxy/EventLoopPerfTracker.js.flow +34 -0
  24. package/dist/inspector-proxy/InspectorProxy.d.ts +53 -0
  25. package/dist/inspector-proxy/InspectorProxy.js +477 -0
  26. package/dist/inspector-proxy/InspectorProxy.js.flow +62 -0
  27. package/dist/inspector-proxy/InspectorProxyHeartbeat.d.ts +24 -0
  28. package/dist/inspector-proxy/InspectorProxyHeartbeat.js +64 -0
  29. package/dist/inspector-proxy/InspectorProxyHeartbeat.js.flow +25 -0
  30. package/dist/inspector-proxy/cdp-types/messages.d.ts +41 -0
  31. package/dist/inspector-proxy/cdp-types/messages.js +1 -0
  32. package/dist/inspector-proxy/cdp-types/messages.js.flow +54 -0
  33. package/dist/inspector-proxy/cdp-types/protocol.d.ts +106 -0
  34. package/dist/inspector-proxy/cdp-types/protocol.js +1 -0
  35. package/dist/inspector-proxy/cdp-types/protocol.js.flow +124 -0
  36. package/dist/inspector-proxy/types.d.ts +115 -0
  37. package/dist/inspector-proxy/types.js +1 -0
  38. package/dist/inspector-proxy/types.js.flow +152 -0
  39. package/dist/middleware/openDebuggerMiddleware.d.ts +36 -0
  40. package/dist/middleware/openDebuggerMiddleware.js +216 -0
  41. package/dist/middleware/openDebuggerMiddleware.js.flow +36 -0
  42. package/dist/types/BrowserLauncher.d.ts +62 -0
  43. package/dist/types/BrowserLauncher.js +1 -0
  44. package/dist/types/BrowserLauncher.js.flow +66 -0
  45. package/dist/types/EventReporter.d.ts +124 -0
  46. package/dist/types/EventReporter.js +1 -0
  47. package/dist/types/EventReporter.js.flow +151 -0
  48. package/dist/types/Experiments.d.ts +30 -0
  49. package/dist/types/Experiments.js +1 -0
  50. package/dist/types/Experiments.js.flow +34 -0
  51. package/dist/types/Logger.d.ts +15 -0
  52. package/dist/types/Logger.js +1 -0
  53. package/dist/types/Logger.js.flow +16 -0
  54. package/dist/utils/DefaultBrowserLauncher.d.ts +30 -0
  55. package/dist/utils/DefaultBrowserLauncher.js +57 -0
  56. package/dist/utils/DefaultBrowserLauncher.js.flow +29 -0
  57. package/dist/utils/getBaseUrlFromRequest.d.ts +14 -0
  58. package/dist/utils/getBaseUrlFromRequest.js +19 -0
  59. package/dist/utils/getBaseUrlFromRequest.js.flow +17 -0
  60. package/dist/utils/getDevToolsFrontendUrl.d.ts +29 -0
  61. package/dist/utils/getDevToolsFrontendUrl.js +58 -0
  62. package/dist/utils/getDevToolsFrontendUrl.js.flow +29 -0
  63. package/package.json +97 -0
@@ -0,0 +1,34 @@
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
+ export type Experiments = $ReadOnly<{
12
+ /**
13
+ * Enables the handling of GET requests in the /open-debugger endpoint,
14
+ * in addition to POST requests. GET requests respond by redirecting to
15
+ * the debugger frontend, instead of opening it using the BrowserLauncher
16
+ * interface.
17
+ */
18
+ enableOpenDebuggerRedirect: boolean,
19
+
20
+ /**
21
+ * Enables the Network panel in the debugger frontend.
22
+ */
23
+ // NOTE: Used by Expo, exposing a tab labelled "Network (Expo)"
24
+ enableNetworkInspector: boolean,
25
+
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.
30
+ */
31
+ enableStandaloneFuseboxShell: boolean,
32
+ }>;
33
+
34
+ export type ExperimentsConfig = Partial<Experiments>;
@@ -0,0 +1,15 @@
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
+ export type Logger = Readonly<{
12
+ error: (...message: Array<string>) => void;
13
+ info: (...message: Array<string>) => void;
14
+ warn: (...message: Array<string>) => void;
15
+ }>;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,16 @@
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
8
+ * @format
9
+ */
10
+
11
+ export type Logger = $ReadOnly<{
12
+ error: (...message: Array<string>) => void,
13
+ info: (...message: Array<string>) => void,
14
+ warn: (...message: Array<string>) => void,
15
+ ...
16
+ }>;
@@ -0,0 +1,30 @@
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
+ import type { DebuggerShellPreparationResult } from "../";
12
+ /**
13
+ * Default `BrowserLauncher` implementation which opens URLs on the host
14
+ * machine.
15
+ */
16
+ declare const DefaultBrowserLauncher: {
17
+ /**
18
+ * Attempt to open the debugger frontend in a Google Chrome or Microsoft Edge
19
+ * app window.
20
+ */
21
+ launchDebuggerAppWindow: (url: string) => Promise<void>;
22
+ unstable_showFuseboxShell(url: string, windowKey: string): Promise<void>;
23
+ unstable_prepareFuseboxShell(
24
+ prebuiltBinaryPath?: null | undefined | string,
25
+ ): Promise<DebuggerShellPreparationResult>;
26
+ };
27
+ declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof DefaultBrowserLauncher;
28
+ declare type $$EXPORT_DEFAULT_DECLARATION$$ =
29
+ typeof $$EXPORT_DEFAULT_DECLARATION$$;
30
+ export default $$EXPORT_DEFAULT_DECLARATION$$;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = void 0;
7
+ const {
8
+ unstable_prepareDebuggerShell,
9
+ unstable_spawnDebuggerShellWithArgs,
10
+ } = require("@react-native/debugger-shell");
11
+ const { spawn } = require("child_process");
12
+ const ChromeLauncher = require("chrome-launcher");
13
+ const { Launcher: EdgeLauncher } = require("chromium-edge-launcher");
14
+ const open = require("open");
15
+ const DefaultBrowserLauncher = {
16
+ launchDebuggerAppWindow: async (url) => {
17
+ let chromePath;
18
+ try {
19
+ chromePath = ChromeLauncher.getChromePath();
20
+ } catch (e) {
21
+ chromePath = EdgeLauncher.getFirstInstallation();
22
+ }
23
+ if (chromePath == null) {
24
+ await open(url);
25
+ return;
26
+ }
27
+ const chromeFlags = [`--app=${url}`, "--window-size=1200,600"];
28
+ return new Promise((resolve, reject) => {
29
+ const childProcess = spawn(chromePath, chromeFlags, {
30
+ detached: true,
31
+ stdio: "ignore",
32
+ });
33
+ childProcess.on("data", () => {
34
+ resolve();
35
+ });
36
+ childProcess.on("close", (code) => {
37
+ if (code !== 0) {
38
+ reject(
39
+ new Error(
40
+ `Failed to launch debugger app window: ${chromePath} exited with code ${code}`,
41
+ ),
42
+ );
43
+ }
44
+ });
45
+ });
46
+ },
47
+ async unstable_showFuseboxShell(url, windowKey) {
48
+ return await unstable_spawnDebuggerShellWithArgs([
49
+ "--frontendUrl=" + url,
50
+ "--windowKey=" + windowKey,
51
+ ]);
52
+ },
53
+ async unstable_prepareFuseboxShell(prebuiltBinaryPath) {
54
+ return await unstable_prepareDebuggerShell();
55
+ },
56
+ };
57
+ var _default = (exports.default = DefaultBrowserLauncher);
@@ -0,0 +1,29 @@
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;
@@ -0,0 +1,14 @@
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
+ declare function getBaseUrlFromRequest(
12
+ req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>,
13
+ ): null | undefined | URL;
14
+ export default getBaseUrlFromRequest;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = getBaseUrlFromRequest;
7
+ function getBaseUrlFromRequest(req) {
8
+ const hostHeader = req.headers.host;
9
+ if (hostHeader == null) {
10
+ return null;
11
+ }
12
+ const scheme = req.socket.encrypted === true ? "https" : "http";
13
+ const url = `${scheme}://${req.headers.host}`;
14
+ try {
15
+ return new URL(url);
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
@@ -0,0 +1,17 @@
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
+ // Determine the base URL (scheme and host) used by a client to reach this
12
+ // server.
13
+ //
14
+ // TODO: Support X-Forwarded-Host, etc. for trusted proxies
15
+ declare export default function getBaseUrlFromRequest(
16
+ req: http$IncomingMessage<tls$TLSSocket> | http$IncomingMessage<net$Socket>,
17
+ ): ?URL;
@@ -0,0 +1,29 @@
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
+ import type { Experiments } from "../types/Experiments";
12
+ /**
13
+ * Get the DevTools frontend URL to debug a given React Native CDP target.
14
+ */
15
+ declare function getDevToolsFrontendUrl(
16
+ experiments: Experiments,
17
+ webSocketDebuggerUrl: string,
18
+ devServerUrl: string,
19
+ options?: Readonly<{
20
+ relative?: boolean;
21
+ launchId?: string;
22
+ telemetryInfo?: string;
23
+ /** Whether to use the modern `rn_fusebox.html` entry point. */
24
+ useFuseboxEntryPoint?: boolean;
25
+ appId?: string;
26
+ panel?: string;
27
+ }>,
28
+ ): string;
29
+ export default getDevToolsFrontendUrl;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = getDevToolsFrontendUrl;
7
+ function getDevToolsFrontendUrl(
8
+ experiments,
9
+ webSocketDebuggerUrl,
10
+ devServerUrl,
11
+ options,
12
+ ) {
13
+ const wsParam = getWsParam({
14
+ webSocketDebuggerUrl,
15
+ devServerUrl,
16
+ });
17
+ const appUrl =
18
+ (options?.relative === true ? "" : devServerUrl) +
19
+ "/debugger-frontend/" +
20
+ (options?.useFuseboxEntryPoint === true
21
+ ? "rn_fusebox.html"
22
+ : "rn_inspector.html");
23
+ const searchParams = new URLSearchParams([
24
+ [wsParam.key, wsParam.value],
25
+ ["sources.hide_add_folder", "true"],
26
+ ]);
27
+ if (experiments.enableNetworkInspector) {
28
+ searchParams.append("unstable_enableNetworkPanel", "true");
29
+ }
30
+ if (options?.launchId != null && options.launchId !== "") {
31
+ searchParams.append("launchId", options.launchId);
32
+ }
33
+ if (options?.appId != null && options.appId !== "") {
34
+ searchParams.append("appId", options.appId);
35
+ }
36
+ if (options?.telemetryInfo != null && options.telemetryInfo !== "") {
37
+ searchParams.append("telemetryInfo", options.telemetryInfo);
38
+ }
39
+ if (options?.panel != null && options.panel !== "") {
40
+ searchParams.append("panel", options.panel);
41
+ }
42
+ return appUrl + "?" + searchParams.toString();
43
+ }
44
+ function getWsParam({ webSocketDebuggerUrl, devServerUrl }) {
45
+ const wsUrl = new URL(webSocketDebuggerUrl);
46
+ const serverHost = new URL(devServerUrl).host;
47
+ let value;
48
+ if (wsUrl.host === serverHost) {
49
+ value = wsUrl.pathname + wsUrl.search + wsUrl.hash;
50
+ } else {
51
+ value = wsUrl.host + wsUrl.pathname + wsUrl.search + wsUrl.hash;
52
+ }
53
+ const key = wsUrl.protocol.slice(0, -1);
54
+ return {
55
+ key,
56
+ value,
57
+ };
58
+ }
@@ -0,0 +1,29 @@
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 { Experiments } from "../types/Experiments";
12
+
13
+ /**
14
+ * Get the DevTools frontend URL to debug a given React Native CDP target.
15
+ */
16
+ declare export default function getDevToolsFrontendUrl(
17
+ experiments: Experiments,
18
+ webSocketDebuggerUrl: string,
19
+ devServerUrl: string,
20
+ options?: $ReadOnly<{
21
+ relative?: boolean,
22
+ launchId?: string,
23
+ telemetryInfo?: string,
24
+ /** Whether to use the modern `rn_fusebox.html` entry point. */
25
+ useFuseboxEntryPoint?: boolean,
26
+ appId?: string,
27
+ panel?: string,
28
+ }>,
29
+ ): string;
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "@depup/react-native__dev-middleware",
3
+ "version": "0.84.1-depup.1",
4
+ "description": "Dev server middleware for React Native (with updated dependencies)",
5
+ "keywords": [
6
+ "@react-native/dev-middleware",
7
+ "depup",
8
+ "updated-dependencies",
9
+ "security",
10
+ "latest",
11
+ "patched",
12
+ "react-native",
13
+ "tools"
14
+ ],
15
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/dev-middleware#readme",
16
+ "bugs": "https://github.com/facebook/react-native/issues",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/facebook/react-native.git",
20
+ "directory": "packages/dev-middleware"
21
+ },
22
+ "license": "MIT",
23
+ "exports": {
24
+ ".": "./dist/index.js",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "changes.json",
30
+ "README.md"
31
+ ],
32
+ "scripts": {},
33
+ "dependencies": {
34
+ "@isaacs/ttlcache": "^2.1.4",
35
+ "@react-native/debugger-frontend": "0.84.1",
36
+ "@react-native/debugger-shell": "0.84.1",
37
+ "chrome-launcher": "^1.2.1",
38
+ "chromium-edge-launcher": "^0.3.0",
39
+ "connect": "^3.7.0",
40
+ "debug": "^4.4.3",
41
+ "invariant": "^2.2.4",
42
+ "nullthrows": "^1.1.1",
43
+ "open": "^11.0.0",
44
+ "serve-static": "^2.2.1",
45
+ "ws": "^8.20.0"
46
+ },
47
+ "devDependencies": {
48
+ "@react-native/debugger-shell": "0.84.1",
49
+ "selfsigned": "^4.0.0",
50
+ "undici": "^5.29.0",
51
+ "wait-for-expect": "^3.0.2"
52
+ },
53
+ "engines": {
54
+ "node": ">= 20.19.4"
55
+ },
56
+ "depup": {
57
+ "changes": {
58
+ "@isaacs/ttlcache": {
59
+ "from": "^1.4.1",
60
+ "to": "^2.1.4"
61
+ },
62
+ "chrome-launcher": {
63
+ "from": "^0.15.2",
64
+ "to": "^1.2.1"
65
+ },
66
+ "chromium-edge-launcher": {
67
+ "from": "^0.2.0",
68
+ "to": "^0.3.0"
69
+ },
70
+ "connect": {
71
+ "from": "^3.6.5",
72
+ "to": "^3.7.0"
73
+ },
74
+ "debug": {
75
+ "from": "^4.4.0",
76
+ "to": "^4.4.3"
77
+ },
78
+ "open": {
79
+ "from": "^7.0.3",
80
+ "to": "^11.0.0"
81
+ },
82
+ "serve-static": {
83
+ "from": "^1.16.2",
84
+ "to": "^2.2.1"
85
+ },
86
+ "ws": {
87
+ "from": "^7.5.10",
88
+ "to": "^8.20.0"
89
+ }
90
+ },
91
+ "depsUpdated": 8,
92
+ "originalPackage": "@react-native/dev-middleware",
93
+ "originalVersion": "0.84.1",
94
+ "processedAt": "2026-03-21T20:09:20.467Z",
95
+ "smokeTest": "failed"
96
+ }
97
+ }