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

mayi_track

v1.0.8

Published

让我等菜鸟有参考的依据,并且代码写的如此清晰方便我们编写自己的npm,所有的使用介绍文档,可以参看阿里云的介绍。

Readme

首先感谢大神们

让我等菜鸟有参考的依据,并且代码写的如此清晰方便我们编写自己的npm,所有的使用介绍文档,可以参看阿里云的介绍。

链接地址如下:阿里ARMS参考网站

本仓库都是基于版本1.8.18进行改写的。 增加了mayiPos的config入参。可以将对应的请求参数回调给页面,方便页面进行后续的处理。 如果后续需要升级的话,请先下载最新的阿里版本在进行相的更改很升级。 本代码没有任何窃取的意思,所有对应的参数还是会上报阿里云的ARMS。我们还是持续在使用ARMS的服务。

再次感谢阿里的前端大神们提供如此好用的类库和方便自定义化的代码。

安装

npm i mayi_track

小程序的使用方法如下:

import WXLogger from 'mayi_track/mayi';
let uid = getStorage('uid');
const Monitor = WXLogger.init({
   pid:process.env.NODE_ENV === 'production' ? 'i1q10f1wc1@61a6dff3ab977ba' : 'i1q10f1wc1@0619812df83aff8',
   // enableSPA:true,
   setUsername: function () {
     return ' ' + uid;
   },
   ignore:{
     ignoreApis:['xxxx/gr/get-wy-surplus-num']
   },
   region: 'cn',
   mayiPos: (value) => {
       uni.showToast({
           icon: 'success',
           title: '回调mayiPos调用了',
           duration: 1800,
        })
        uni.request({
           url: 'xxxx/gr/get-wy-surplus-num',
           method: 'GET',
           data: {
               key: '111'
           },
           success: function (res) {
               uni.showToast({
                   icon: 'success',
                   title: '请求后台调用了',
                   duration: 1800,
                })
            }
        })
    }  
});
export default Monitor;  

H5的使用方法如下:

const BrowserLogger = require('mayi_track');
// BrowserLogger.singleton(conf) conf传入config配置。
const Monitor = BrowserLogger.singleton({
pid: process.env.NODE_ENV === 'production' ? 'i1q10f1wc1@61a6dff3ab977ba' : 'i1q10f1wc1@0619812df83aff8',
page: 'H5',
setUsername: function() {
   return 'wangxiuyuan' || null;
 },
ignore: {
    ignoreApis: [/get-wy-surplus-num/,function(str) { // 方法
                       if (str && str.indexOf('get-wy-surplus-num1') >= 0) return true;   // 不上报
                       return false;   // 上报
                   }]
},
 imgUrl: 'https://arms-retcode.aliyuncs.com/r.png?',
 mayiPos: (value) => {
   uni.showToast({
    icon: 'success',
     title: '回调mayiPos调用了',
     duration: 800,
   })
   uni.request({
     url: 'https://gr-api.mayitest.cn/gr/get-wy-surplus-num',
     method: 'GET',
     data: {
       key: '111'
     },
     success: function(res) {
       uni.showToast({
         icon: 'success',
         title: '请求后台调用了',
         duration: 800,
       })
     }
   })
 }
});
export default Monitor;

uni-app使用方法如下:

import WeexLogger from 'mayi_track/weex';
const fetch = weex.requireModule('stream').fetch;
let uid = getStorage('uid');
const serialize = (data) => {
  data = data || {};
  var arr = [];
  for (var k in data) {
    if (Object.prototype.hasOwnProperty.call(data, k) && data[k] !== undefined) {
      arr.push(k + '=' + encodeURIComponent(data[k]).replace(/\(/g, '%28').replace(/\)/g, '%29'));
      }
    }
  return arr.join('&');
}
const Monitor = WeexLogger.singleton({
  pid: process.env.NODE_ENV === 'production' ? 'i1q10f1wc1@61a6dff3ab977ba' : 'i1q10f1wc1@0619812df83aff8',
  // disableHook: true,
  page:'Home',
  mayiUrl:"d2323",
  setUsername: function () {
    return uid || null;
  },
  ignore:{
    ignoreApis:['xxxx/gr/get-wy-surplus-num']
  },
  imgUrl: 'https://arms-retcode.aliyuncs.com/r.png?', // 设定日志上传地址。如需部署至新加坡地域,则改为'https://arms-retcode-sg.aliyuncs.com/r.png?'。
  //设置GET上报方法,示例如下:
  sendRequest: (data, imgUrl) => {
    console.log('monitor-app-get');
  const url = imgUrl + serialize(data);
    fetch({
      method: 'GET',
      url
    });
  },
// 设置POST上报方法,示例如下:
  postRequest: (data, imgUrl) => {
    console.log('monitor-app-post');
    fetch({
      method: 'POST',
      type: 'json',
      url: imgUrl,
      body: JSON.stringify(data)
    });
  },
  // 设置回调
  mayiPos: (value) => {
    uni.showToast({
      icon: 'success',
      title: '回调mayiPos调用了',
      duration: 1800,
    })
    uni.request({
        url: 'xxxx/gr/get-wy-surplus-num',
        method: 'GET',
        data: value,
        success: function (res) {
          uni.showToast({
            icon: 'success',
            title: '请求后台调用了',
            duration: 1800,
          })
        }
      })
  }
});

注意事项

因为小程序和H5都有自动上报,所以ignore一定要设置,否则会重复调用接口。

npm发布模式

npm login根据提示输入用户名和密码,login过后,就每次执行publish就可以了。

npm publish 发布,因为国内跟npm链接不好,有时候会失败,多试几次就好了。