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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fura

v0.1.2

Published

文件使用关系分析(File usage relationship analysis)

Readme

fura

文件使用关系分析(File usage relationship analysis)

内部体验测试中,api可能不稳定

背景

秉着学习进步的基础原则,自己造一次轮子来实现需求

能力

  • 生成项目目录树
  • 分析项目未使用的npm包

MVP

  • [x] 解析js文件并分析依赖
  • [x] cli工具能力提供
  • [x] 识别函数对应的注释
  • [x] 日志统一/输出

P1

  • [ ] 完整使用文档提供
  • [ ] 循环依赖识别警告
  • [ ] 可基于git仓库进行分析
  • [x] 支持多入口识别未使用文件分析
  • [x] 支持多入口文件关系识别分析
  • [x] 使用ora做loading优化
  • [ ] 生成svg节点可跳转对应仓库/本地文件
  • [ ] cli命令行可视化交互
  • [ ] 精细化识别文件/npm包之间的引用内容

P2

  • [x] 缓存生成
  • [ ] package.json使用type=module
  • [ ] 支持自建mermaid服务
  • [ ] 完善代码注释

如何使用

1.安装

npm i fura --save-dev

2.项目根目录增加.furarc配置

example

{
  "alias": {
    "@": "./src"
  },
  // 识别的入口文件(必须)
  "entry": [
    "./src/index.ts",
    "./src/bin/index.ts"
  ],
  // 包含的目录(可选,无则根目录)
  "include": [
    "./src"
  ],
  // 忽略的目录名(可选)
  "exclude": [
    "dist"
  ]
}

3.运行命令 fura <action>

fura unused 分析项目内未使用的文件以及npm依赖

  • npm依赖仅分析dependencies内部依赖
    • 注意会识别出仅开发需要使用的依赖却安装到dependencies上的,例如eslint

fura schema

基于.furarc配置的entry内容进行依赖分析输出svg内容

fura diff-influence [target branch]

指定目标分支进行代码diff关系链路识别,不指定target branch则分析本地变更与当前分支远端变更的差异

fura pkg <packages>

指定包名分析对应的代码依赖路径,一般用于升级包版本评估影响范围用

example

fura pkg @babel/parser lodash

npm-pkg-relation.svg

cli

代码注释建议

  • 使用@name声明当前文件主要能力,例如(首页/用户头像组件/首页标题)
  • 使用@group声明分组
    • 页面: page
    • 组件: component
    • 模块(js方法类等): module

更适合的是使用@category,考虑到更优化的编辑器提示以及编写,所以还是选择@group

落地效果

./.fura/comment-relation.svg

使用介绍

home.js

/**
 * 首页入口文件
 * 
 * @name 项目首页
 * @group page 
 * 
*/

import Layout from './Layout';

export default () => <Layout>hello home page</Layout>

layout.js

/**
 * 首页Layout
 * 
 * @name 首页layout
 * @group component 
 * 
 * @privateRemarks
 * 
 * 这里会解析,识别出是`首页layout组件`
*/
export default ({children}) => {
  return <div>{children}</div>
}

route.js

/**
 * 应用路由声明
*/
import Home from './home'

export default () => (
  <Routes>
    <Route path="/" element={<Home />}>
  </Routes>
)

其他说明

  • 考虑到生成的关系图更精准有效,fura暂时仅对文件头部注释进行特定字段解析使用,解析字段标准参考typedoc
  • 其他代码注释使用标准建议参考TSDocjsdoc

本项目内部分注释由open ai生成

参考

  • 在ts中寻找出未使用的导出模块 github
  • 在您JS/TS项目中查找未使用的文件、依赖项和导出 github
  • 读取tsconfig,并在项目中找出未使用的ts导出 github
  • 检查代码中未使用模块,eslint/no-unused-vars
  • 自动修复代码中异常代码块,eslint --fix
  • umi检查未使用代码导出配置 文档
  • Madge 是一个开发人员工具,用于生成模块依赖关系的可视化图表、查找循环依赖关系并为您提供其他有用的信息。github