# System map — mswjs/msw

> Canonical page: https://codevetter.com/unpack/msw/system-map

# System map — mswjs/msw

Scanned commit 6d6aef1640ace2ce2bd90252c71bdbc53262efd3 (2026-09-30). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

The package exposes separate environment and protocol entrypoints around one shared network engine. Browser HTTP interception uses a Service Worker when available, with an interceptor fallback; WebSocket interception remains a separate source. Node combines four interceptor types and adds asynchronous handler contexts. Distribution consists of ESM modules, declarations, an IIFE bundle, and a generated worker asset, with release automation targeting npm.
- package.json declares ESM, Node >=22.12.0, pnpm 11.27.1, and conditional exports that reject msw/browser in Node and msw/node in browsers. — [package.json#L5-L22](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/package.json#L5-L22) [package.json#L74-L76](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/package.json#L74-L76)
- The root entry exports HTTP, WebSocket, SSE, and utilities; GraphQL is exposed through its separate package subpath rather than the root barrel. — [src/core/index.ts#L1-L28](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/index.ts#L1-L28) [src/core/index.ts#L75-L83](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/index.ts#L75-L83) [package.json#L31-L46](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/package.json#L31-L46)
- defineNetwork owns readyState, resolved options, the handler controller, and lifecycle event forwarding; each source queues frames that select handlers and resolve themselves. — [src/core/experimental/define-network.ts#L106-L129](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/experimental/define-network.ts#L106-L129) [src/core/experimental/define-network.ts#L181-L206](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/experimental/define-network.ts#L181-L206) [src/core/experimental/sources/network-source.ts#L27-L43](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/experimental/sources/network-source.ts#L27-L43)
- setupWorker configures ServiceWorkerSource or FallbackHttpSource for HTTP and an InterceptorSource containing WebSocketInterceptor for WebSocket connections. — [src/browser/setup-worker.ts#L51-L78](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/browser/setup-worker.ts#L51-L78) [src/browser/sources/fallback-http-source.ts#L10-L18](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/browser/sources/fallback-http-source.ts#L10-L18)
- setupServer combines ClientRequest, XMLHttpRequest, Fetch, and WebSocket interceptors with AsyncHandlersController, then wraps the network in the common listen/close API. — [src/node/setup-server.ts#L16-L45](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/node/setup-server.ts#L16-L45) [src/node/setup-server.ts#L47-L59](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/node/setup-server.ts#L47-L59) [src/node/setup-server-common.ts#L20-L41](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/node/setup-server-common.ts#L20-L41)
- Browser state includes a tough-cookie jar persisted under __msw-cookie-store__ and WebSocket client metadata stored in IndexedDB; Node leaves implicit cookie management to the client and uses memory when IndexedDB is unavailable. — [src/core/utils/cookie-store.ts#L12-L25](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/utils/cookie-store.ts#L12-L25) [src/core/utils/cookie-store.ts#L89-L100](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/core/utils/cookie-store.ts#L89-L100) [src/ws/websocket-client-manager.ts#L36-L45](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/ws/websocket-client-manager.ts#L36-L45) [src/ws/websocket-indexeddb-client-store.ts#L5-L28](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/src/ws/websocket-indexeddb-client-store.ts#L5-L28)
- tsdown builds ESM entries with declarations and source maps, a Node-platform Vite integration, and the MockServiceWorker IIFE; the worker build injects package version and checksum placeholders. — [tsdown.config.ts#L37-L88](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/tsdown.config.ts#L37-L88) [tsdown.config.ts#L90-L123](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/tsdown.config.ts#L90-L123) [config/copy-service-worker.ts#L35-L44](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/config/copy-service-worker.ts#L35-L44)
- Scripts provide lint, build, Vitest projects, Playwright, module compatibility, typings, publint, and knip; scheduled/manual releases build and test before publishing through the provenance-enabled release profile. — [package.json#L77-L96](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/package.json#L77-L96) [.github/workflows/release.yml#L28-L50](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/.github/workflows/release.yml#L28-L50) [.github/workflows/release.yml#L69-L92](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/.github/workflows/release.yml#L69-L92) [release.config.json#L3-L7](https://github.com/mswjs/msw/blob/6d6aef1640ace2ce2bd90252c71bdbc53262efd3/release.config.json#L3-L7)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
