$ show callstack/repack
This is callstack/repack, a monorepo providing a toolkit to replace Metro with Webpack or Rspack for React Native bundling. It delivers a production-grade build pipeline with CLI commands (`start`, `bundle`), a custom Fastify-based dev server with HMR, symbolication, and WebSocket messaging, and over 20 Webpack/Rspack plugins for code splitting, Module Federation (V1/V2), Hermes bytecode compilation, code signing, and asset handling. The architecture is modular: a core `packages/repack` package contains loaders (assets, babel-swc, flow, react-refresh), runtime modules (ScriptManager, Federated helpers), and native Android/iOS code for script loading and code signing. A separate `packages/dev-server` package provides a bundler-agnostic server with delegate interfaces, and first-party plugins for NativeWind, Reanimated, and Expo modules are maintained alongside. The project supports both Webpack 5 and Rspack 1.x/2.x, with extensive integration tests and Metro-compatibility resolver tests. Module Federation is a key feature, enabling micro-frontend architectures in React Native apps with dynamic script loading via the client-side ScriptManager. The codebase is actively maintained with frequent releases, dependency updates, and a well-structured monorepo using pnpm, Turborepo, and Changesets. It demonstrates high craftsmanship in its plugin architecture, WebSocket server design, and source map symbolication, though dual bundler support and multiple Federation plugin versions add some complexity.
The LLM identified 3 files worth highlighting for reuse:
Provides source map based stack trace symbolication for React Native. It accepts raw stack frames, resolves source maps (including inline), and returns symbolicated frames with original source positions. The implementation handles multi-source bundles, cache busting, and error formatting. This is a standalone, well-typed service that could be extracted and reused in any JavaScript debugging tool (e.g., Node.js error reporting, webpack dev server middlewares) with minimal changes.
Abstract base class for WebSocket servers in the dev server. It manages connection lifecycle, message parsing, client registration, and broadcasting. Subclasses implement specific protocols (HMR, events, messages, debugger). The pattern is clean: it uses a generic message type, handles serialization/deserialization, and provides a consistent interface for sending updates. This could be extracted as a reusable WebSocket server foundation for any Node.js project requiring multiple typed WS endpoints.
Generates a complete Webpack/Rspack `resolve` configuration object that mirrors Metro's module resolution behavior for React Native. It handles platform-specific extensions (`.ios.js`, `.native.js`, etc.), asset extensions, react-native field mapping, and module path ordering. The function is highly parameterized (accepts platform, bundler type, environment) and produces a deterministic output. This is a prime example of a configuration preset that could be adapted for any framework needing platform-aware resolution, and it demonstrates deep knowledge of both Metro and Webpack resolve internals.