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

debughelp

v1.0.5

Published

调试用的一些脚本 , 可能会持续更新

Readme

DebugHelp

DebugHelp 是一个调试工具库,提供了多种功能,包括对象属性访问监控和模块加载路径解析,方便开发者在调试过程中快速定位问题。

安装

使用 npm 安装:

npm install debughelp

功能

1. 监控对象键访问

通过 viewGet 函数,可以监控一个对象的键访问,适用于调试时查看对象属性的使用情况。

示例

const { viewGet } = require("debughelp");

const obj = { a: 1, b: 2, c: 3 };
viewGet(obj);

// 访问对象属性时会触发日志输出
console.log(obj.a); // 输出: ["a", 1]

2. 对象属性访问监控

通过 addGetDebug 和 addSetDebug 函数,可以监控对象属性的获取和设置操作。

函数定义

const { addGetDebug, addSetDebug } = require("debughelp");

const obj = { name: "John", age: 30 };

// 监控属性获取
addGetDebug(obj, "name", (prop, value) => {
    console.log(`属性 ${prop} 被获取,值为: ${value}`);
});

// 监控属性设置
addSetDebug(obj, "age", (prop, value) => {
    console.log(`属性 ${prop} 被设置,值为: ${value}`);
});

// 测试
console.log(obj.name); // 输出: 属性 name 被获取,值为: John
obj.age = 31;          // 输出: 属性 age 被设置,值为: 31

功能

1. 解决 import {} 无法引入 *.js 文件的问题

通过 importHook.js,可以解决在使用 import {} 时,无法正确引入没有显式 .js 后缀的模块的问题。

使用方法

在运行 Node.js 脚本时,添加 --loader 参数指定 importHook.js

node --loader debughelp/importHook.js your-script.mjs

示例

假设有以下文件结构:

project/
├── main.mjs
├── utils/
│   └── helper.js

main.mjs 中:

import { someFunction } from './utils/helper';

运行时可能会报错,提示找不到模块 ./utils/helper。通过指定 --loader debughelp/importHook.js,可以自动补全 .js 后缀,解决此问题:

node --loader debughelp/importHook.js main.mjs

2. 支持递归引用

importHook.js 还支持递归引用模块,确保在模块之间存在循环依赖时,能够正确解析路径并加载模块。

示例

假设有以下文件结构:

project/
├── a.mjs
├── b.mjs

a.mjs 中:

import { funcB } from './b.mjs';
export function funcA() {
  console.log('Function A');
  funcB();
}

b.mjs 中:

import { funcA } from './a.mjs';
export function funcB() {
  console.log('Function B');
  funcA();
}

通过 --loader debughelp/importHook.js,可以正确处理这种递归引用:

node --loader debughelp/importHook.js a.mjs

许可证

本项目基于 ISC 许可证。 ```