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

bufan-hardhat-strip-comments

v1.0.0

Published

Hardhat plugin to strip comments from contracts during verification with custom Dubai ASCII art headers

Readme

hardhat-strip-comments-plugin

Hardhat插件,用于在验证合约时去除注释并支持自定义头部样式注释。

功能

  • 去除合约代码中的所有注释
  • 支持两种预定义的ASCII艺术头部样式:迪拜风格和标准风格
  • 自动提取合约名称
  • 允许添加自定义头部注释(例如版权声明)
  • 支持保留SPDX许可证标识符
  • 可以作为独立任务运行或自动与verify任务集成
  • 支持排除特定文件

安装

第1步:安装依赖

npm install strip-comments --save-dev

第2步:复制插件代码

将本插件目录下的index.js文件复制到您的项目中,例如放在plugins/hardhat-strip-comments-plugin.js路径下。

第3步:在Hardhat配置中导入插件

在您的hardhat.config.js文件中添加:

// 导入插件
require("./plugins/hardhat-strip-comments-plugin");

module.exports = {
  // ... 其他配置 ...
  
  // 插件配置
  stripComments: {
    enabled: true,
    headerStyle: "dubai", // 可选值: "dubai" 或 "standard"
    authorInfo: {
      author: "VeloraChain",
      createdDate: "2025-05-11",
      purpose: "VeloraChain Blockchain Technology Token",
      description: "This is no ordinary code — it carries ambition, and marks a legend on-chain."
    },
    excludedFiles: ["某些不需要处理的文件.sol"],
    preserveLicense: true
  },
  
  // ... 其他配置 ...
};

使用方法

方法1:作为独立任务运行

您可以手动运行任务来处理合约文件:

npx hardhat strip-comments --input contracts/MarsTokenOptimized.sol --output stripped-contracts

方法2:与验证任务集成

插件会自动与verify任务集成。当您运行验证任务时,它会自动处理合约文件:

npx hardhat verify --network bscmainnet 0x合约地址 "构造函数参数"

或者指定合约名称和路径:

npx hardhat verify --network bscmainnet --contract "contracts/MarsTokenOptimized.sol:MarsTokenOptimized" 0x合约地址 "构造函数参数"

配置选项

hardhat.config.js中,您可以设置以下选项:

| 选项 | 类型 | 默认值 | 说明 | |------|------|--------|------| | enabled | Boolean | true | 是否启用插件 | | headerStyle | String | "dubai" | 头部样式,可选值: "dubai" 或 "standard" | | customHeader | String | "// SPDX-License-Identifier: MIT" | 自定义头部(如果不使用预定义样式) | | excludedFiles | Array | [] | 不处理的文件列表 | | preserveLicense | Boolean | true | 是否保留SPDX许可证标识符 | | authorInfo.author | String | "VeloraChain" | 作者信息 | | authorInfo.createdDate | String | "2025-05-11" | 创建日期 | | authorInfo.purpose | String | "VeloraChain Blockchain Technology Token" | 项目目的 | | authorInfo.description | String | "This is no ordinary code — it carries ambition, and marks a legend on-chain." | 项目描述 |

头部样式示例

迪拜风格 (dubai)

// SPDX-License-Identifier: MIT
/*
        🌴🏜️  𓆃  DUBAI SMART CONTRACT 𓆃  🏜️🌴
        ────────────────────────────────
        "Built beneath the sun, coded 
         for fortune, destined for legend."

 Contract Name : YourContractName
 Author        : VeloraChain
 Created Date  : 2025-05-11
 Purpose       : VeloraChain Blockchain Technology Token
 Description   : This is no ordinary code — it carries ambition, and marks a legend on-chain.
*/

标准风格 (standard)

// SPDX-License-Identifier: MIT
/*
  ___        _    _                   _     
 | _ \__ _ _| |_ (_)_ _  __ _ ___  __| |___ 
 |  _/ _` | | ' \| | ' \/ _` / -_)/ _` (_-< 
 |_| \__,_|_|_||_|_|_||_\__, \___|\_\_,/__/ 
                        |___/              

 Contract Name : YourContractName
 Author        : VeloraChain
 Created Date  : 2025-05-11
 Purpose       : VeloraChain Blockchain Technology Token
 Description   : This is no ordinary code — it carries ambition, and marks a legend on-chain.
*/

注意事项

  • 处理后的文件会保存在输出目录(默认为stripped-contracts)中
  • 该插件不会修改原始文件
  • 验证时会自动使用处理后的无注释版本