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

@blackglory/bundle

v0.6.0

Published

一种用于描述文档的目录结构, 受到[TextBundle]的启发.

Readme

bundle

一种用于描述文档的目录结构, 受到TextBundle的启发.

与TextBundle的不同点:

  • Bundle直接以目录结构在文件系统里表示, 不需要打包.
  • Bundle的文本文件和元数据文件的格式是任意的, 不局限于Markdown和JSON.

Install

npm install --save @blackglory/bundle
# or
yarn add @blackglory/bundle

定义

一个典型的bundle目录结构如下:

.
├── assets
│   ├── foo.png
│   └── bar.png
├── meta.json
└── text.md

bundle目录下的其他文件和目录会被忽略, 从而允许在此存放临时文件, 系统文件和版本控制系统.

/

bundle的根目录, 目录名称是随意的, 只需要便于人类识别.

/meta.{extension}

bundle的元数据, 它是一种能够被解析为键值对字典的文件, 格式不受限制, 取决于具体实现.

如果meta文件不存在, 或meta文件存在多个, 则不会将此目录视作一个bundle.

/meta.{variant}.{extension}

bundle元数据的变体.

相同变体名的meta文件只能存在一个, 否则将被视作无效变体.

/text.{extension}

bundle的文本, 格式不受限制, 取决于具体实现.

如果text文件不存在, 或text文件存在多个, 则不会将此目录视作一个bundle.

/text.{variant}.{extension}

bundle文本的变体.

相同变体名的text文件只能存在一个, 否则将被视作无效变体.

/assets/**/*.{extension}

bundle的资源文件.

API

interface IBundle {
  /**
   * The path of the root directory.
   */
  root: string

  /**
   * The path of the meta file, relative to the root directory.
   */
  meta: string

  /**
   * The path of the text file, relative to the root directory.
   */
  text: string

  /**
   * The paths of assets, relative to the root directory.
   */
  assets: string[]

  /**
   * The variants.
   */
  variants: Record<string, IBundleVariant>
}

interface IBundleVariant {
  /**
   * The path of the meta file variant, relative to the root directory.
   */
  meta?: string

  /**
   * The path of the text file variant, relative to the root directory.
   */
  text?: string
}

buildBundle

/**
 * @throws {NotDirectoryError}
 * @throws {NoMetaFileError}
 * @throws {NoTextFileError}
 * @throws {TooManyMetaFilesError}
 * @throws {TooManyTextFilesError}
 */
function buildBundle(pathname: string): Promise<IBundle>

isBundle

function isBundle(pathname: string): Promise<boolean>

findAllBundles

function findAllBundles(pathname: string): AsyncIterable<IBundle>