Skip to content

Modularize the devtools client packages#17

Merged
sugarmanz merged 3 commits into
mainfrom
client-split
Jul 21, 2026
Merged

Modularize the devtools client packages#17
sugarmanz merged 3 commits into
mainfrom
client-split

Conversation

@sugarmanz

@sugarmanz sugarmanz commented Jul 21, 2026

Copy link
Copy Markdown
Member

What's changing

Restructures the devtools client into focused, single-purpose packages so consumers only pull in what they need — headless consumers no longer drag in React, and the MCP server no longer drags in the Flipper transport.

  • @player-devtools/client is now headless: createExtensionClient + state reducer, no React.
  • @player-devtools/client-react (new) holds the React Panel + hooks.
  • @player-devtools/client-flipper (new) holds FlipperServerTransport, reusable by any client context (e.g. an Electron app). The Transport interface moves to @player-devtools/types; the MCP server depends only on that interface and composes the concrete transport at its entry point.
  • Consumers repointed: flipper-pluginclient-react; the MCP server → the headless client core + client-flipper.

Also fixes the MCP transport under Node < 22 (provides a ws WebSocket, which reconnecting-websocket otherwise resolves from a missing global), and bumps the CI base executor to xlarge to stop the Bazel server being OOM-killed during release.

Change Type (required)

  • patch
  • minor
  • major

Tests

  • bazel build / typecheck / eslint / vitest pass across client/core, client/react, client/flipper, mcp, types.
  • Independent review of the extraction diff: clean.
  • bazel run //devtools/mcp:start boots end-to-end (transport from client-flipper, flipper-server ready, clients connect, plugins load).
  • NPX consumer path verified under Node 20 against the published canary: npx player-devtools-mcp boots and connects.

Release Notes

The devtools client is now split into focused packages so you only install what you use:

  • @player-devtools/client — headless client (createExtensionClient, state reducer). No React dependency.
  • @player-devtools/client-react — the React Panel and hooks. If you were importing Panel from @player-devtools/client, import it from @player-devtools/client-react instead:
    import { Panel } from "@player-devtools/client-react";
  • @player-devtools/client-flipper — the headless FlipperServerTransport, for connecting to a Player over a running flipper-server from any Node client.
  • Node < 22 support for the MCP server

Split @player-devtools/client into two packages so headless consumers
(the MCP server) never load React:

- core → @player-devtools/client: headless createExtensionClient + state
  reducer. No React deps.
- react → @player-devtools/client-react: the React Panel + hooks.

Consumers repointed: flipper-plugin uses client-react; MCP uses the
headless client core, decoupling it from the UI barrel.

Also:
- Fix MCP transport for Node < 22: provide a `ws` WebSocket to
  reconnecting-websocket via a guarded globalThis polyfill (it has no
  global WebSocket, so npx-run MCP failed to connect). ws deps live in
  the BUILD only, per repo convention.
- Keep INITIAL_FLOW (a UI placeholder) in the Panel, not exported from
  core; move @player-ui/player to core test_deps since only the reducer
  test uses it now.
Move FlipperServerTransport out of the MCP module so it can be reused by
other client contexts (e.g. an Electron app):

- New package @player-devtools/client-flipper (devtools/client/flipper)
  holds FlipperServerTransport (moved from devtools/mcp/src/transport.ts),
  including the Node <22 `ws` WebSocket polyfill.
- The Transport interface (CommunicationLayerMethods + connect/close)
  moves to @player-devtools/types as the shared contract. MCPServer now
  depends only on that interface, not on the concrete transport.
- client-flipper is imported solely by devtools/mcp/bin/run, which
  composes it with MCPServer. Nothing in mcp/src references it.
- mcp barrel exports only MCPServer; mcp sheds flipper-server,
  flipper-server-client, ws, and @types/ws (now client-flipper's).
@sugarmanz
sugarmanz requested a review from a team as a code owner July 21, 2026 21:59
@sugarmanz

Copy link
Copy Markdown
Member Author

/canary

1 similar comment
@sugarmanz

Copy link
Copy Markdown
Member Author

/canary

Canary pipeline #166 failed with the Bazel server killed mid-build
(error code 14, 'Socket closed') — memory pressure on the runner while
building the Android/toolchain targets. Bump the base executor from
large to xlarge to give Bazel more headroom, and drop the pinned
bazel-docker:9 tag to track the latest image.
@sugarmanz

Copy link
Copy Markdown
Member Author

/canary

@sugarmanz sugarmanz changed the title Split devtools client (core/react) and extract Flipper transport Modularize the devtools client packages Jul 21, 2026
@sugarmanz
sugarmanz merged commit c8275ff into main Jul 21, 2026
8 checks passed
@sugarmanz
sugarmanz deleted the client-split branch July 21, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants