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

ync-cli-puppeteer-check

v0.0.7

Published

puppeteer 页面内容获取、页面错误捕获、页面性能测试

Readme

简介

通过 puppeteer 和 window.performance API,结合命令行工具可以获取页面 url 在 3g/4g 网络下的页面性能,具体包括:

  • dns查询时间
  • tcp连接时间
  • request请求时间
  • 白屏时间
  • dom树解析时间
  • domReady时间
  • onLoad时间

同时可以捕获页面的报错信息,具体包括:

  • 监听页面error事件:捕获页面崩溃错误信息
  • 监听页面pageerror事件:捕获页面报错信息
  • 监听页面requestfailed事件:捕获页面请求失败信息

如何扩展此 cli 工具

# 安装依赖【切记不能通过 cnpm 安装,否则下面 link 和 test 会报错】
npm ci

# puppeteer 安装较慢可以采用如下方法单独安装
PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors npm i puppeteer -S

# link
npm run link

# 本地测试
npm run test

# 发布
npm publish --access=public

如何使用此 cli 工具

# 全局安装
npm install ync-cli-puppeteer-check -g

# 执行命令
npx ync-puppeteer-check -u https://www.answera.top -n 4g

参数描述

| 参数名 | 类型 | 说明 | 默认值 | 必须 | | --- | --- | --- | --- | --- | | url | String | 页面链接 | N/A | 是 | | network | String | 网络模式,3g/4g | 3g | 否 |

数据返回

| 返回 | 类型 | 含义 | | --- | --- | --- | --- | --- | | error | Object | 错误信息,如果不存在错误则返回空对象 | | error.crash | String | 崩溃错误信息 | | error.page | String | 页面报错信息 | | error.request | String | 请求报错信息 | | performance | Object | 性能信息 | | performance.dns | Number | dns解析时间 | | performance.tcp | Number | tcp解析时间 | | performance.whiteScreen | Number | 白屏时间 | | performance.request | Number | 请求时间 | | performance.domReady | Number | dom完备时间,即DOMContentLoaded事件完成时时间 | | performance.domParsed | Number | dom解析时间 | | performance.pageReady | Number | 页面完备时间 |

参考资料