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

srparser

v0.0.1

Published

source parser

Readme

概述

本库通过解析源码来获取路径、项目基本信息。

使用指南

本库包含parseSource、parseProject两个核心方法。

parseSource

入参

参数 | 类型 | 含义 | 默认 | 必须 ---|---|---|---|--- cwd | string | 根路径 | process.cwd() | 是 source | string | 源码目录名,基于根路径 | | 否 exclude | string[] | 解析排除的路径 | | 否

返回

参数 | 类型 | 含义 ---|---|--- base | string | 项目基础路径 aliases | object | 路径别名 deps | object | 依赖包 pathList | array | 路径解析结果列表 pathList[i].origin | string | 原始路径 pathList[i].file | string | 所在文件 pathList[i].type | string | 路径类型,dep/alias/relative/absolute/error pathList[i].path | string | 解析后路径,基于源码目录 pathList[i].alias | [string, string] | 路径别名,当type为alias时有效 pathList[i].dep | string | 依赖包名,当type为dep时有效 pathList[i].depVersion | string | 依赖包版本号,当type为dep时有效 errorPathList | array | 路径解析出错结果列表,元素内容同pathList

parseProject

项目信息解析当前只支持react/vue/angular三大框架。

入参

参数 | 类型 | 含义 | 默认 | 必须 ---|---|---|---|--- cwd | string | 根路径 | process.cwd() | 是 source | string | 源码目录名,基于根路径 | | 否 exclude | string[] | 解析排除的路径 | | 否

返回

参数 | 类型 | 含义 ---|---|--- frame | object | 当前项目使用框架 frame.key | string | 框架名,react/vue/angular frame.exist | boolean | 框架包是否存在 frame.name | string | 框架包名 frame.version | string | 框架包版本 frame.mainVersion | number | 框架包主版本号 cli | object | 当前项目使用脚手架 cli.key | string | 脚手架名,webpack/vite cli.exist | boolean | 脚手架包是否存在 cli.name | string | 脚手架包名 cli.version | string | 脚手架包版本 cli.mainVersion | number | 脚手架包主版本号 frameCli | object | 当前项目框架使用脚手架 frameCli.key | string | 框架脚手架名,cra/vue-cli/angular-cli frameCli.exist | boolean | 框架脚手架包是否存在 frameCli.name | string | 框架脚手架包名 frameCli.version | string | 框架脚手架包版本 frameCli.mainVersion | number | 框架脚手架包主版本号 frameRouter | object | 当前项目框架使用路由 frameRouter.key | string | 框架路由名,react-router/vue-router/angular-router frameRouter.exist | boolean | 框架路由包是否存在 frameRouter.name | string | 框架路由包名 frameRouter.version | string | 框架路由包版本 frameRouter.mainVersion | number | 框架路由包主版本号 lang | string | 项目使用语言,ts/js