Skip to content

v4.2.1 — Split monoliths into per-concern modules

Choose a tag to compare

@pranko17 pranko17 released this 19 May 10:21
· 50 commits to main since this release

Patch on top of v4.2.0. Seven commits, one publicly visible addition, six pure refactors.

Public

  • logBoxModule is now exported from the root entry barrel. Previously you had to reach for the react-native-mcp-kit/modules subpath:
    // before
    import { logBoxModule } from 'react-native-mcp-kit/modules';
    // now also works
    import { logBoxModule } from 'react-native-mcp-kit';

Internal — no behaviour change

Five large files were carrying multiple obligations in one place. Each got split into a folder with a clear file-per-concern layout, so an agent (or human) reading the codebase pulls only the section they need into context instead of skimming through 600-1000 lines.

Before After
server/mcpServer.ts (1086 lines) mcpServer.ts (67) + dispatch.ts + helpers.ts + predicate.ts + instructions.ts + tools/<one-per-MCP-tool>.ts
server/host/deviceResolver.ts (741) deviceResolver/{types, list, byClient, byId, scan, enrich, index}.ts
server/host/tools/input.ts (622, 7 tools) tools/input/<one-per-tool>.ts + tools/input/{constants, android}.ts
babel/testIdPlugin.ts (737) testIdPlugin/{types, constants, helpers, hocUnwrap, collectHooks, inject, index}.ts
modules/fiberTree/utils.ts (690) utils/{constants, root, naming, projection, serialize, traverse, match, screen, native, index}.ts
modules/fiberTree/hooks.ts (686) hooks/{types, patterns, shape, value, slotCount, flatten, options, extract, index}.ts

Largest file in the result set: ~230 lines. Most are 50-150.

Where each file was imported via the folder name (e.g. import … from './tools/input'), TypeScript's resolution transparently picks up <folder>/index.ts, so the rewrites are invisible to importers. The one subpath that pointed at a specific compiled file — react-native-mcp-kit/babel/test-id-plugin — was bumped in package.json exports from ./dist/babel/testIdPlugin.js to ./dist/babel/testIdPlugin/index.js. Same import path for callers, new dist target.

Docs

The root CLAUDE.md (~410 lines) was likewise split into a 102-line top-level index plus 19 per-subdirectory guides. Claude Code lazily pulls each subdirectory's guide only when it reads into that subtree — so a session that only touches `src/modules/network/` doesn't burn context on the server-side internals.