react-native-debug-toolkit 3.3.2 → 3.3.3

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
@@ -77,7 +77,13 @@ In the app, open Debug Panel -> `DevConnect` -> `Send Once` or `Start Live Sync`
77
77
 
78
78
  DevConnect auto-detects simulator/emulator and uses local host settings automatically. On real devices, enter your computer IP to connect.
79
79
 
80
- For Remote JS Bundle, run Metro on your computer, enter computer IP and Metro port in `DevConnect`, then tap `Use Metro Bundle`. DevConnect writes React Native's native dev-server host setting and reloads the app. The IP and ports are persisted through AsyncStorage when installed, or through the native module after rebuild.
80
+ For Remote JS Bundle, run Metro on your computer, enter computer IP and Metro port in `DevConnect`, then tap `Use Metro Bundle`. DevConnect persists the host and hot-reloads from Metro.
81
+
82
+ > **Debug builds only.** Metro host switching works in Debug builds. Release builds load the embedded bundle and the controls are disabled (`release: disabled` badge).
83
+
84
+ **iOS — no AppDelegate changes required.** On install, DevConnect hooks `RCTBundleURLProvider` so the app **cold-starts from the embedded `main.jsbundle`** and only connects to Metro after you apply a host in the panel (fixes Expo `.expo/.virtual-metro-entry` red screens when Metro is off). Use **Reset** to go back to the embedded bundle.
85
+
86
+ The IP and ports are persisted through AsyncStorage when installed, or through the native module after rebuild.
81
87
 
82
88
  QR scan is optional. Install `react-native-camera-kit` or `expo-camera` in the app to enable the scan button. The app must request camera permission before scanning.
83
89
 
package/README.zh-CN.md CHANGED
@@ -77,7 +77,13 @@ App 内打开 Debug Panel -> `DevConnect` -> `Send Once` 或 `Start Live Sync`
77
77
 
78
78
  DevConnect 自动识别模拟器/真机,模拟器下自动使用本机 Metro/daemon 地址。真机需输入电脑 IP 地址。
79
79
 
80
- Remote JS Bundle:先在电脑启动 Metro,在 `DevConnect` 输入电脑 IP 和 Metro 端口,然后点 `Use Metro Bundle`。DevConnect 会写入 React Native 原生 dev-server host 设置并 reload App。IP 和端口会通过 AsyncStorage 持久化;如果没装 AsyncStorage,则在重建后通过本库原生模块持久化。
80
+ Remote JS Bundle:先在电脑启动 Metro,在 `DevConnect` 输入电脑 IP 和 Metro 端口,然后点 `Use Metro Bundle`。DevConnect 会持久化 host 并从 Metro 热重载。
81
+
82
+ > **仅 Debug 包可用。** Release 包控件会显示 `release: disabled` 并禁用。
83
+
84
+ **iOS — 无需改 AppDelegate。** 安装本库后会 hook `RCTBundleURLProvider`:**未配置 IP 时冷启动走内置 `main.jsbundle`**,只有在面板里应用 host 后才连 Metro(可避免 Metro 未开时的 `.expo/.virtual-metro-entry` 红屏)。点 **Reset** 可回到内置 bundle。
85
+
86
+ IP 和端口会通过 AsyncStorage 持久化;如果没装 AsyncStorage,则在重建后通过本库原生模块持久化。
81
87
 
82
88
  扫码是可选能力。App 安装 `react-native-camera-kit` 或 `expo-camera` 后,DevConnect 才显示扫码按钮。App 仍需自己配置相机权限文案,并在使用扫码前申请相机权限。
83
89
 
@@ -27,10 +27,19 @@ function hasHelpFlag(args) {
27
27
  function printHelp() {
28
28
  process.stderr.write(
29
29
  'Usage: debug-toolkit [--host 0.0.0.0] [--port 3799] [--token dev-token] [--store ~/.react-native-debug-toolkit/daemon-devices.json] [--daemon-only]\n'
30
+ + ' debug-toolkit embed [--platform ios|android] [--undo] [--yes]\n'
30
31
  + '\n'
31
32
  + 'Starts the debug toolkit: daemon (HTTP + Web Console) and MCP stdio server.\n'
32
33
  + '\n'
33
- + 'Options:\n'
34
+ + 'Commands:\n'
35
+ + ' embed Embed JS bundle in debug builds (run in host app root)\n'
36
+ + '\n'
37
+ + 'Embed options:\n'
38
+ + ' --platform <p> Target platform: ios or android (default: both)\n'
39
+ + ' --undo Remove embed injections\n'
40
+ + ' --yes Skip confirmations (CI/EAS)\n'
41
+ + '\n'
42
+ + 'Daemon options:\n'
34
43
  + ' --host <addr> Host to bind (default: 0.0.0.0)\n'
35
44
  + ' --port <port> Port to bind (default: 3799)\n'
36
45
  + ' --token <str> Auth token for daemon endpoints\n'
@@ -57,6 +66,12 @@ async function main() {
57
66
  return;
58
67
  }
59
68
 
69
+ // Route embed subcommand
70
+ if (args[0] === 'embed') {
71
+ const { main: embedMain } = require('../scripts/embed');
72
+ return embedMain(args.slice(1));
73
+ }
74
+
60
75
  const host = readOption(args, '--host', process.env.DEBUG_TOOLKIT_DAEMON_HOST || DEFAULT_HOST);
61
76
  const port = Number(readOption(args, '--port', process.env.DEBUG_TOOLKIT_DAEMON_PORT || DEFAULT_PORT));
62
77
  const token = readOption(args, '--token', process.env.DEBUG_TOOLKIT_DAEMON_TOKEN || '');
@@ -0,0 +1,17 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ /**
6
+ Returns a Metro bundle URL when the user has applied a host via DevConnect; otherwise nil.
7
+
8
+ Zero-config: installing this pod hooks RCTBundleURLProvider so cold start uses the embedded
9
+ main.jsbundle until DevConnect applies a host. You do not need to change AppDelegate.
10
+
11
+ Optional override for custom bundleURL() implementations:
12
+
13
+ if let metro = DebugToolkitMetroBundleURL() { return metro }
14
+ */
15
+ FOUNDATION_EXPORT NSURL * _Nullable DebugToolkitMetroBundleURL(void);
16
+
17
+ NS_ASSUME_NONNULL_END