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

dougong

v0.8.3

Published

Capability composition and structured lifetime kernel, plus its plugin distribution layer.

Readme

dougong

简体中文 · English


简体中文

能力组合与结构化生命周期内核,纯 JavaScript/TypeScript。

这是门面包,聚合 @dougongjs/core、@dougongjs/reactive 与 @dougongjs/platform。它只做 re-export,不包含任何逻辑——架构门禁会强制这一点。

npm install dougong
import { createHost, definePlugin, service } from "dougong"

const CLOCK = service<Clock>("app/clock")

const clock = definePlugin({
  name: "app.clock",
  provides: { clock: CLOCK },
  setup: () => ({ clock: { now: () => new Date() } }),
})

const greeter = definePlugin({
  name: "app.greeter",
  requires: { clock: CLOCK },
  setup(ctx) {
    console.log(ctx.clock.now())
  },
})

const host = createHost({ name: "hello" })
host.install(greeter)
host.install(clock)
await host.start()

六个原子:Service(稳定的一对一能力)、ExtensionPoint(开放贡献集合)、Event(瞬时事实)、Lifetime(结构化所有权)、Plugin、Host。

三条核心保证:依赖与所有权显式写在声明里;每个语义只有一条正式路径;事务只暴露已提交状态。

环境要求

Node.js ≥ 22;浏览器 / WebView 基线为 Chrome / Edge 119、Firefox 121、Safari 17.4,并提供 Promise.withResolvers()。显式 .dispose() 在全部基线上可用;using / await using 还要求运行时原生提供或应用预先 polyfill Symbol.dispose / Symbol.asyncDispose。Dougong 不修改全局对象。TypeScript 消费者需要:

"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]

English

A capability composition and structured lifetime kernel in pure JavaScript/TypeScript.

This is the facade package aggregating @dougongjs/core, @dougongjs/reactive and @dougongjs/platform. It only re-exports and contains no logic — an architecture gate enforces that.

npm install dougong
import { createHost, definePlugin, service } from "dougong"

const CLOCK = service<Clock>("app/clock")

const clock = definePlugin({
  name: "app.clock",
  provides: { clock: CLOCK },
  setup: () => ({ clock: { now: () => new Date() } }),
})

const greeter = definePlugin({
  name: "app.greeter",
  requires: { clock: CLOCK },
  setup(ctx) {
    console.log(ctx.clock.now())
  },
})

const host = createHost({ name: "hello" })
host.install(greeter)
host.install(clock)
await host.start()

Six atoms: Service (a stable one-to-one capability), ExtensionPoint (an open contribution set), Event (a transient fact), Lifetime (structured ownership), Plugin, Host.

Three core guarantees: dependencies and ownership are written explicitly in declarations; every semantic has exactly one canonical path; transactions expose only committed state.

Requirements

Node.js ≥ 22; Chrome / Edge 119, Firefox 121 or Safari 17.4 for browsers and WebViews, with Promise.withResolvers(). Explicit .dispose() works throughout; using / await using additionally require native or application-polyfilled Symbol.dispose / Symbol.asyncDispose. Dougong does not mutate globals. TypeScript consumers need:

"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]

  • 文档站 / Documentation: https://tangerg.github.io/dougong/
  • 仓库 / Repository: https://github.com/Tangerg/dougong

早期 0.x 开发阶段,当前不承诺向后兼容。 Early 0.x development; no backward-compatibility promises yet.

MIT