npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@webbridge-native/native-bridge

v0.6.0

Published

Native network bridge for WebBridge Native — iOS NSURLProtocol & Android OkHttp interceptor for DevTools visibility

Readme

@webbridge-native/native-bridge

RN DevTools Network 탭에서 모든 요청을 볼 수 있게 하는 네이티브 브릿지.

왜 필요한가?

MSW 같은 JS-only mock은 native 레이어를 거치지 않아 RN DevTools에 보이지 않습니다.

❌ JS fetch() → MSW 가로채기 → 가짜 응답 (DevTools: 아무것도 없음)
✅ JS fetch() → Native 레이어(DevTools 감시) → Bridge → JS 핸들러 → 합성 응답(DevTools에 표시)

native-bridge브라우저 Service Worker의 RN 버전입니다.

설치

pnpm add @webbridge-native/native-bridge

iOS:

cd ios && pod install

사용법

Preset과 함께 (권장)

import { setupWebBridge, http, HttpResponse } from '@webbridge-native/preset';

const { client, dispose } = setupWebBridge({
  cookies: true,
  headers: { userAgent: 'browser-like' },
  mock: {
    handlers: [
      http.get('https://api.myapp.com/users', () =>
        HttpResponse.json([{ id: 1, name: 'Alice' }]),
      ),
    ],
  },
  nativeBridge: true, // DevTools 가시성 활성화
});

const res = await client.fetch('https://api.myapp.com/users');
// RN DevTools Network 탭에서 이 요청이 보입니다

dispose(); // 정리

단독 사용

import { WebBridgeClient } from '@webbridge-native/core';
import { createNativeBridgeInterceptor } from '@webbridge-native/native-bridge';
import { MockServer, http, HttpResponse } from '@webbridge-native/mock';

const server = new MockServer([
  http.get('https://api.myapp.com/users', () =>
    HttpResponse.json([{ id: 1, name: 'Alice' }]),
  ),
]);
server.listen();

const client = new WebBridgeClient();
const bridge = createNativeBridgeInterceptor({
  mockServer: server,
  timeoutMs: 5000,
});

client.use(bridge); // terminal 인터셉터로 등록

const res = await client.fetch('https://api.myapp.com/users');
// DevTools에 요청/응답이 표시됩니다

bridge.dispose();
server.close();

옵션

| 옵션 | 기본값 | 설명 | |---|---|---| | mockServer | - | MockServer 인스턴스. native에서 가로챈 요청을 핸들러로 매칭 | | requestHandler | - | 커스텀 요청 핸들러 (MockServer보다 우선) | | timeoutMs | 5000 | JS 핸들러 응답 대기 타임아웃 (ms) | | fallbackToFetch | true | Native 모듈 미설치 시 globalThis.fetch 폴백 |

아키텍처

JS 인터셉터 체인 (headers → cookies → custom)
  → nativeBridgeInterceptor (terminal)
    → Native HTTP 레이어 (DevTools 감시 지점)
    → iOS: NSURLProtocol / Android: OkHttp Network Interceptor
    → Bridge: JS에 "핸들러 있나?" 이벤트 발행
    → JS: findHandler() 매칭
    → Mock 응답 → Native로 합성 반환 (DevTools에 응답 표시)
    → 또는 핸들러 없음 → 실제 네트워크 요청 진행

플랫폼별 구현

| 플랫폼 | 인터셉터 | 비동기 전략 | |--------|----------|-------------| | iOS | NSURLProtocol 서브클래스 | 콜백 (startLoading은 이미 비동기) | | Android | OkHttp Network Interceptor | CompletableFuture.get(5s) (워커 스레드 블로킹) |

폴백 모드

Native 모듈이 링크되지 않은 환경(테스트, Expo Go 등)에서는 자동으로 globalThis.fetch 기반 terminal로 동작합니다. 기능적 차이 없이 DevTools 가시성만 비활성화됩니다.

동시 요청

50개 이상의 동시 요청을 안전하게 처리합니다:

  • JS: Map 기반 레지스트리 (싱글 스레드)
  • Android: ConcurrentHashMap + CompletableFuture
  • iOS: DispatchQueue + 배리어 쓰기

요구 사항

  • React Native 0.73+ (New Architecture / TurboModule)
  • iOS 13.4+
  • Android minSdk 24+

License

MIT