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

@playwright-repl/core

v0.20.0

Published

Shared engine, parser, and utilities for the playwright-repl monorepo.

Downloads

1,633

Readme

@playwright-repl/core

Shared engine, parser, and utilities for the playwright-repl monorepo.

Used by playwright-repl (CLI) and @playwright-repl/mcp (MCP server).

Install

npm install @playwright-repl/core playwright

Requires playwright >= 1.59.0-alpha (includes lib/mcp/browser/ engine internals).

Key Exports

Engine

Runs Playwright's browser backend in-process. No daemon, no socket — commands execute directly.

import { Engine } from '@playwright-repl/core';

const engine = new Engine();
await engine.start({ headed: true });

const result = await engine.run({ _: ['goto', 'https://example.com'] });
console.log(result.text);

const snap = await engine.run({ _: ['snapshot'] });
console.log(snap.text);

await engine.close();

EngineOpts (passed to start()):

| Option | Type | Description | |--------|------|-------------| | headed | boolean | Visible browser window | | browser | string | chrome, firefox, webkit, msedge | | persistent | boolean | Persistent browser profile | | profile | string | Profile directory path |

EngineResult:

interface EngineResult {
  text?: string;   // Text output (accessibility tree, command result, error message)
  image?: string;  // Base64 data URL for screenshot commands
  isError?: boolean;
}

BridgeServer

WebSocket server that the Dramaturg Chrome extension connects to. Used by the CLI (--bridge) and MCP server.

import { BridgeServer } from '@playwright-repl/core';

const bridge = new BridgeServer();
await bridge.start(9876);  // default port

bridge.onConnect(() => console.log('Extension connected'));
bridge.onDisconnect(() => console.log('Extension disconnected'));

await bridge.waitForConnection();

const result = await bridge.run('snapshot');
console.log(result.text);

await bridge.close();

Methods:

| Method | Description | |--------|-------------| | start(port?) | Start WebSocket server (default port 9876) | | run(command) | Send a command string to the extension, returns EngineResult | | waitForConnection(timeoutMs?) | Wait until extension connects (default 30s) | | onConnect(fn) | Callback when extension connects | | onDisconnect(fn) | Callback when extension disconnects | | connected | boolean — whether extension is currently connected | | close() | Shut down the server |


parseInput

Parse a raw command string into ParsedArgs.

import { parseInput } from '@playwright-repl/core';

parseInput('click "Submit"');
// → { _: ['click', 'Submit'] }

parseInput('fill "Email" [email protected]');
// → { _: ['fill', 'Email', '[email protected]'] }

parseInput('snapshot');
// → { _: ['snapshot'] }

Returns null for unrecognized commands.


buildCompletionItems

Autocomplete data for all .pw commands, with descriptions and usage hints.

import { buildCompletionItems } from '@playwright-repl/core';

const items = buildCompletionItems();
// → [{ label: 'goto', detail: 'Navigate to a URL', ... }, ...]

File Structure

src/
├── engine.ts           # In-process Playwright backend (Engine class)
├── bridge-server.ts    # WebSocket bridge server (BridgeServer class)
├── extension-server.ts # HTTP command server (CommandServer class — internal)
├── parser.ts           # Command parsing + alias resolution
├── page-scripts.ts     # Text locators + assertion helpers (serializable fns)
├── completion-data.ts  # Autocomplete items for all commands
├── resolve.ts          # COMMANDS map, minimist re-export, version
├── colors.ts           # ANSI color helpers
└── index.ts            # Public exports