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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vsirrr/qa-console

v0.1.0

Published

a console toolkit like vconsole for kuickapp

Downloads

1

Readme

@vsirrr/qa-console

背景

  • tencent/vconsole 依赖于 DOM,在快应用中不能使用。

目前支持的功能

  • 重写了 console 的 log、error、debug 方法,所以只能收集通过 console.log()、console.error()、console.debug() 输出的内容,其他特殊异常无法捕获。
  • 目前一共有四个面板:Log(普通日志)、Error(错误日志)、Request(请求信息,包含请求的 url、type、status、params、response 等信息)、Storage(本地存储)
  • 长按输出的 log、error 日志内容,可以复制文本;长按 request 中的参数和返回值可以复制文本;长按 Storage 的 value 值可以复制文本。
  • 每个面板底部的工具栏:点击 clear 按钮是清空对应的内容,点击 hide 按钮是关闭弹层。

使用方式

安装

npm i -D @vsirrr/qa-console

demo

// 1. 在 app.ux 中进行初始化
if(process.env.NODE_ENV === 'development') {
  require('@vsirrr/qa-console')
}

// 2. 在使用该功能的地方引入 qa-console 组件 不支持单次引用多页面使用
<import name="qa-console" src="@vsirrr/qa-console/component.ux"></import>

<qa-console></qa-console>

// 3. 接口提供的 @system.fetch 无法被重写。所以在封装的请求库中使用 console.debug() 方法,收集请求与响应的信息
import $fetch from '@system.fetch'

function request(params) {
  return new Promise((resolve, reject) => {
    $fetch.fetch({
      url: params.url,
      method: params.method,
      data: params.data,
      responseType: 'json',
      success: (response) => {
        console.debug({
          url: params.url,
          method: params.method,
          params: params.data,
          data: response.data,
          status: 'success',
        })
        resolve(response.data)
      },
      fail: (error, code) => {
        const data =
          Object.prototype.toString.call(error).slice(8, -1) === 'Object'
            ? { code, ...error }
            : { code, error }
        console.debug({
          data,
          url: params.url,
          method: params.method,
          params: params.data,
          status: 'error',
        })
        reject(error)
      },
    })
  })
}

注意事项

  • 使用完 qa-console 组件之后,把相关代码注释掉,防止打包时增加包的体积。