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

@nasl/cli

v0.1.4

Published

NASL (Next Application Specific Language) CLI tool for checking, compiling and developing NASL code

Readme

@nasl/cli

NASL 语言的命令行工具,提供编译、检查、开发服务等功能。

目前只支持 NaturalTS 表示的 NASL 代码,编译为 Vue 和 JS。

安装

pnpm install -g @nasl/cli

使用

初始化配置

nasl init

会在当前目录创建 nasl.config.json 配置文件。

{
  "serverBaseURL": "https://nasl.lcap.163yun.com/api/v1/nasl", // NASL 编译服务的基础 URL
  "representation": "NaturalTS", // NASL 语言的表示
  "namespaceResolution": "filename-as-namespace", // 命名空间解析策略
  "ideVersion": "4.1", // IDE 版本
  "srcDir": "src", // 源代码目录
  "outDir": "out" // 输出目录
}

入口文件说明

下面的命令中均支持 [entry] 参数,表示入口文件:

  • 入口文件可选,不填则表示处理整个 src 目录
  • 入口文件路径相对于项目目录,但必须在 src 目录下
  • 支持具体文件和 glob 模式(注意要用引号包裹)
    • src/app.enums.Status.ts 支持具体文件
    • "src/app.enums.*.ts" 表示所有枚举
    • "src/app.{.entities..ts,structures..ts,enums..ts}" 表示所有实体、数据结构和枚举,即全部用户自定义类型
    • "src/app.logics.*.ts" 表示所有逻辑文件
    • "src/*.tsx" 表示所有页面文件
  • 会自动进行依赖分析,收集所有依赖的文件
  • 依赖的页面文件(.tsx)不会继续进行依赖分析,而是直接提取签名,以提高性能

编译 NASL 代码

# 编译整个 src 目录
nasl compile

# 编译指定入口文件及其依赖(自动进行依赖分析)
nasl compile src/app.frontendTypes.pc.frontends.pc.views.dashboard.tsx
# 或使用简写
naslc src/app.frontendTypes.pc.frontends.pc.views.dashboard.tsx
naslc "src/app.enums.*.ts"
naslc "src/app.{*.entities.*.ts,structures.*.ts,enums.*.ts}"
naslc "src/app.logics.*.ts"
naslc "src/*.tsx"

检查 NASL 代码

# 检查整个 src 目录
nasl check

# 检查指定入口文件及其依赖(自动进行依赖分析)
nasl check src/app.frontendTypes.pc.frontends.pc.views.dashboard.tsx
nasl check "src/app.enums.*.ts"
nasl check "src/app.{*.entities.*.ts,structures.*.ts,enums.*.ts}"
nasl check "src/app.logics.*.ts"
nasl check "src/*.tsx"

依赖分析

建议指定入口文件,否则会扫描整个 src 目录,输出量较大。

nasl dep "src/app.enums.*.ts"
nasl dep "src/app.{*.entities.*.ts,structures.*.ts,enums.*.ts}"
nasl dep "src/app.logics.loadStudentList.ts"
nasl dep "src/*.tsx"
nasl dep

启动开发服务

nasl dev

启动开发服务后,默认可以访问 http://localhost:3100 查看预览效果。

开发 CLI 工具

# 安装依赖
pnpm install

# 构建
pnpm run build

# 开发模式(监听文件变化)
pnpm run dev

# 代码检查
pnpm run lint

# 代码修复
pnpm run lint:fix

# 代码格式化
pnpm run format