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

lvyjs

v0.3.0-alpha.5

Published

tsx compile script

Downloads

136

Readme

LVY

基于 tsx、tsdown 构建的,为 Node.js 应用设计的开发与打包工具

| Project | Status | Description | | ------- | --------------------- | ----------- | | lvyjs | lvyjs-s | 打包工具 |

文档: https://lemonade-lab.github.io/lvyjs.dev/

安装

npm install lvyjs -D

快速开始

tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@src/*": ["src/*"]
    }
  },
  "include": ["src/**/*"],
  "extends": "lvyjs/tsconfig.json"
}

lvy.config.ts

import { defineConfig } from 'lvyjs'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
const __dirname = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
  alias: {
    entries: [{ find: '@src', replacement: join(__dirname, 'src') }]
  }
})

开发

# lvy <入口文件> [其他参数]
npx lvy src/index.ts

打包

对 src 目录打包并输出到 lib 目录:

npx lvy build

配置项

env

注入环境变量到 process.env:

export default defineConfig({
  env: {
    MY_VAR: 'hello'
  }
})

alias

路径别名配置:

export default defineConfig({
  alias: {
    entries: [{ find: '@src', replacement: join(__dirname, 'src') }]
  }
})

assets

自定义静态资源识别规则(默认识别 .png|.jpg|.jpeg|.gif|.svg|.webp|.ico):

export default defineConfig({
  assets: {
    filter: /\.(png|jpg|jpeg|gif|svg|webp|ico|yaml|txt|ttf)$/
  }
})

styles

自定义样式文件识别规则(默认识别 .css|.scss|.less|.sass):

export default defineConfig({
  styles: {
    filter: /\.(css|scss|less|sass)$/
  }
})

watch

监听文件/目录变化,自动重启开发进程。支持 glob 模式:

// 简写 - 字符串数组
export default defineConfig({
  watch: ['src/**/*.yaml', 'public']
})

// 完整写法 - 自定义防抖延迟
export default defineConfig({
  watch: {
    paths: ['src/**/*.{yaml,json}', 'config'],
    delay: 1000 // 防抖延迟,默认 500ms
  }
})

build

打包配置(tsdown 引擎,基于 Rolldown,需要 Node.js 22.18+):

export default defineConfig({
  build: {
    input: 'src', // 输入目录,默认 src
    dir: 'lib', // 输出目录,默认 lib
    bundleDeps: false, // 是否把依赖打包进产物,默认 false(Node.js 库默认不打包)
    dts: true, // 生成 .d.ts 声明文件(宽松模式,默认 false)
    // tsdown 专属配置(可选),在默认映射之上覆盖
    tsdown: {
      minify: false
    }
  }
})
  • 输出到 lib 目录,保持源码目录结构(unbundle 模式)
  • 默认不打包依赖:产物保留 import ... from 'pkg',交由运行时解析;需要把依赖打进产物(如前端类应用)时设置 build.bundleDeps: true
  • 默认不生成 .d.ts 声明文件,需要时设置 build.dts: true(宽松模式:能生成的生成,诊断只作警告,无法生成的文件跳过并汇总提示,构建不失败;需要 tsdown 原生严格模式时用 build.tsdown.dts)
  • CJS/JSON 由 Rolldown 内置处理,无需额外插件
  • 样式/静态资源使用 lvyjs 自研插件,与开发模式共用同一套编译管线
  • 别名由 tsdown 内置 alias 处理,产物中的导入会改写为相对路径
  • build.OutputOptions 兼容旧配置:input / dir / intro / outro / sourcemap

静态资源

导入图片等静态资源时,返回文件的绝对路径:

import { readFileSync } from 'fs'
// 得到该文件的绝对路径,类型 string
import img_logo from '../logo.png'
const data = readFileSync(img_logo)

支持别名路径:

import img_logo from '@src/assets/img/logo.png'

样式文件

导入样式文件时,返回编译后 CSS 文件的绝对路径:

import { readFileSync } from 'fs'
// 得到编译后 CSS 文件的绝对路径
import cssURL from '@src/assets/style.css'
// 完整的单文件 CSS 数据(内部引用已合并)
const data = readFileSync(cssURL, 'utf-8')

内置支持 CSS 处理。如需 LESS、SASS/SCSS 支持:

yarn add less sass -D

样式文件中的引用

CSS

@import url('@src/assets/test2.css');
@import url('./test2.css');
/* 支持别名 */

SCSS

@import url('@src/assets/test3.scss');
@import url('./test3.scss');
@import './test3.scss';
@use './test3.scss';
@use '@src/assets/test3.scss'; // 别名导入,编译阶段直接支持

LESS

@import './test1.css';

预处理器文件之间的导入同样会被正确编译:@import url('./test3.scss') 这类写法会先经 Sass/Less 编译再内联,不会把原始源码混进产物;别名导入在编译阶段直接支持(SCSS:@import '@src/xxx.scss' / @use '@src/xxx.scss',LESS:@import '@src/xxx.less')。

PostCSS

通过 postcss.config.cjs 配置 PostCSS 插件。配置了 alias 时自动启用 postcss-import(解析 @import 的别名与相对路径)与 postcss-url(改写 url() 中的别名),并始终内置 autoprefixer。

压缩

yarn add cssnano -D
// postcss.config.cjs
module.exports = {
  plugins: {
    cssnano: {
      preset: 'default'
    }
  }
}

Tailwind CSS

yarn add tailwindcss -D
// postcss.config.cjs
module.exports = {
  plugins: {
    tailwindcss: {}
  }
}
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
export default {
  content: ['./src/**/*.{js,jsx,ts,tsx}']
}