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

@icon-forger/taro

v0.0.3

Published

> Taro 场景下的 SVG 图标编译插件,把业务中的 `.svg` 组件引用转换成统一的 `BaseIcon` 运行时,并在构建阶段自动生成和注入 iconfont 资源。

Readme

@icon-forger/taro

Taro 场景下的 SVG 图标编译插件,把业务中的 .svg 组件引用转换成统一的 BaseIcon 运行时,并在构建阶段自动生成和注入 iconfont 资源。

✨ 功能特性

  • 开箱即用:直接通过 Taro 插件接入,无需手动串联 Babel 和 Webpack 能力
  • SVG 组件替换:将来源于 .svg 的 JSX 组件替换成 <BaseIcon />
  • 自动生成字体:收集命中的 SVG 资源并生成 woff2 与配套样式
  • 自动注入样式:把 iconfont 样式注入到小程序入口样式中

📦 安装

npm install @icon-forger/taro

yarn 安装

yarn add @icon-forger/taro

pnpm 安装

pnpm add @icon-forger/taro

⚙️ 配置

// config/index.js
module.exports = {
  compiler: {
    type: 'webpack5'
  },
  plugins: ['@icon-forger/taro']
}

🚀 使用

业务代码

import {Icon} from '@/assets/icons/search.svg'

export default function Demo () {
  return <Search size={28} color="#222222" className="demo-icon" />
}

类型提示

在 global.d.ts 新增以下内容

/// <reference types="@icon-forger/taro/types" />

📝 工作原理

  1. 在 Taro babelLoader 中自动注入 @icon-forger/compiler/babel
  2. 遇到来源于 .svg 的 JSX 组件时,替换成 <BaseIcon name="图标名" />
  3. 透传原 JSX 上的属性,例如 sizecolorclassName
  4. 注册 IconForgerPlugin 统一收集 SVG 资源并生成 iconfont
  5. 注册 InjectIconFont 将生成后的字体样式注入到 app 入口样式

⚠️ 注意事项

  1. 依赖 Taro 构建链:该包不是通用 React 图标库,主要服务于 Taro 插件接入场景。
  2. 依赖 @tarojs/components@tarojs/taro:使用前请保证宿主项目已经安装对应 peerDependencies。
  3. 样式后缀按环境注入:当前支持 weappalipaytt 三类样式后缀映射。

📄 许可证

MIT License