react-native-debug-toolkit 3.3.0 → 3.3.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.
@@ -21,11 +21,9 @@ static NSURL *devconnect_sourceURLForBridge(id self, SEL _cmd, RCTBridge *bridge
21
21
  {
22
22
  NSString *metroHost = [[NSUserDefaults standardUserDefaults] stringForKey:kDevConnectMetroHost];
23
23
  if (metroHost.length > 0) {
24
- RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
25
- NSString *saved = settings.jsLocation;
26
- settings.jsLocation = metroHost;
27
- NSURL *url = [settings jsBundleURLForBundleRoot:DebugToolkitBundleRoot];
28
- settings.jsLocation = saved;
24
+ NSString *urlStr = [NSString stringWithFormat:
25
+ @"http://%@/%@.bundle?platform=ios&dev=true&minify=false&lazy=true", metroHost, DebugToolkitBundleRoot];
26
+ NSURL *url = [NSURL URLWithString:urlStr];
29
27
  NSLog(@"[DevConnect] swizzle: returning Metro URL %@ (host=%@)", url, metroHost);
30
28
  return url;
31
29
  }
@@ -58,16 +56,17 @@ RCT_EXPORT_MODULE(DebugToolkitDevConnect)
58
56
  @synthesize bridge = _bridge;
59
57
  @synthesize bundleManager = _bundleManager;
60
58
 
61
- + (void)load
59
+ __attribute__((constructor))
60
+ static void devconnect_swizzle_init(void)
62
61
  {
63
- // Stage 1: Try standard AppDelegate class name (covers ObjC and most Swift apps)
62
+ // Runs after all +load methods, before main() same timing as +load but no conflict with RCT_EXPORT_MODULE
64
63
  swizzleSourceURLForBridge(NSClassFromString(@"AppDelegate"));
65
64
  }
66
65
 
67
66
  - (instancetype)init
68
67
  {
69
68
  if ((self = [super init])) {
70
- // Stage 2: Fallback — use actual delegate class at runtime
69
+ // Fallback — use actual delegate class at runtime (covers custom class names / Swift)
71
70
  if (!original_sourceURLForBridge) {
72
71
  Class delegateClass = object_getClass([UIApplication sharedApplication].delegate);
73
72
  swizzleSourceURLForBridge(delegateClass);
@@ -142,7 +141,11 @@ RCT_EXPORT_METHOD(applyMetroHost:(NSString *)hostPort
142
141
  formatter.numberStyle = NSNumberFormatterDecimalStyle;
143
142
  NSNumber *portNumber = [formatter numberFromString:port];
144
143
  if (portNumber == nil) {
144
+ #ifdef RCT_METRO_PORT
145
145
  portNumber = [NSNumber numberWithInt:RCT_METRO_PORT];
146
+ #else
147
+ portNumber = [NSNumber numberWithInt:8081];
148
+ #endif
146
149
  }
147
150
 
148
151
  NSString *normalizedHostPort = [NSString stringWithFormat:@"%@:%d", host, portNumber.intValue];
@@ -162,9 +165,12 @@ RCT_EXPORT_METHOD(applyMetroHost:(NSString *)hostPort
162
165
  RCTBundleManager *bm = [self resolveBundleManager];
163
166
  if (bm) {
164
167
  bm.bundleURL = bundleURL;
165
- } else if (bundleURL) {
168
+ }
169
+ #ifdef RCTReloadCommandSetBundleURL
170
+ else if (bundleURL) {
166
171
  RCTReloadCommandSetBundleURL(bundleURL);
167
172
  }
173
+ #endif
168
174
 
169
175
  NSLog(@"[DevConnect] applyMetroHost: %@ | bm=%@ | bridge=%@ | url=%@",
170
176
  normalizedHostPort, bm ? @"YES" : @"nil", _bridge ? @"YES" : @"nil", bundleURL);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-debug-toolkit",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "A local-first React Native debug toolkit with Web Console, HTTP API, and MCP support for AI-readable app logs",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",