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

@dyyz1993/xpage

v1.0.6

Published

Browser automation engine library based on Playwright

Readme

Documentation CI

npm xpage npm xcli-core npm create-xcli

Coverage License

mpage

插件化 CLI 框架 + 浏览器自动化引擎,5 分钟创建你的领域 CLI 工具。

它能做什么?

  • 浏览器自动化 — 35+ 页面命令、录制/回放、页面结构提取
  • 插件系统 — TypeScript 运行时加载,命令覆盖/增强
  • 脚手架 — 一条命令生成项目,5 种模板覆盖常见场景
  • 通用框架 — 领域无关的核心设计,不绑定浏览器/数据库/API

快速开始

1. 创建项目

npx create-xcli my-tool

交互式选择模板:base / browser / database / api / plugin

2. 浏览器自动化(@dyyz1993/xpage)

import { executePageCommand, RecorderController, PlaybackEngine } from '@dyyz1993/xpage';
import { chromium } from 'playwright-core';

const browser = await chromium.launch();
const page = await browser.newPage();

// 导航 + 获取标题
await executePageCommand(page, 'goto', { url: 'https://example.com' });
const { title } = await executePageCommand(page, 'title', {});
console.log(title); // "Example Domain"

// 页面结构提取
const { structure } = await executePageCommand(page, 'structure', { selector: 'body' });

// 录制用户操作
const recorder = new RecorderController(page);
await recorder.start({ url: 'https://example.com', name: 'demo' });
// ... 用户在浏览器中操作 ...
const { path } = await recorder.stop('./recordings/demo.yaml');

// 回放录制
const player = await PlaybackEngine.fromFile(page, './recordings/demo.yaml');
await player.play({ slowMo: 1 });

await browser.close();

3. 创建 CLI 工具(@dyyz1993/xcli-core)

import { Core, ok, fail } from '@dyyz1993/xcli-core';
import { z } from 'zod';

const app = new Core({
  name: 'my-tool',
  version: '0.1.0',
  description: '我的 CLI 工具',
  configDirName: '.my-tool',
  envPrefix: 'MY_TOOL',
  pluginDirs: ['./plugins'],
});

const site = app.loader.getAPI().createSite({
  name: 'builtin',
  url: 'https://example.com',
});

site.command('hello', {
  description: '打个招呼',
  parameters: z.object({ name: z.string().default('World') }),
  handler: async (params, ctx) => {
    return ok({ message: `Hello, ${params.name}!` }, [`向 ${params.name} 打了招呼`]);
  },
});

await app.run(process.argv.slice(2));

4. 开发插件

import type { XCLIAPI } from '@dyyz1993/xcli-core';
import { ok } from '@dyyz1993/xcli-core';
import { z } from 'zod';

export default function (xcli: XCLIAPI): void {
  const site = xcli.createSite({
    name: 'my-plugin',
    url: 'https://example.com',
  });

  site.command('greet', {
    description: '问候命令',
    parameters: z.object({
      name: z.string().describe('被问候者'),
      lang: z.enum(['zh', 'en']).default('zh').describe('语言'),
    }),
    handler: async (params, ctx) => {
      const greeting = params.lang === 'zh' ? `你好, ${params.name}!` : `Hello, ${params.name}!`;
      return ok({ greeting }, [greeting]);
    },
  });
}

包结构

本项目是 monorepo,包含以下包:

| 包 | 用途 | |---|---| | @dyyz1993/xcli-core | CLI 框架核心 — 插件加载、命令路由、Session 管理、脚手架引擎 | | @xcli/browser-app | 浏览器自动化 — 35+ 页面命令、录制/回放、结构提取 | | create-xcli | 脚手架工具 — 一条命令生成项目 |

文档

完整文档:https://dyyz1993.github.io/mpage/

开发

pnpm install
pnpm run build
pnpm run test

License

MIT