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

@idooel/runtime-context

v0.0.1-beta.2

Published

Runtime data pool with namespaces, stackable contexts, subscriptions and optional persistence. Vue adapter included.

Readme

@idooel/runtime-context

轻量运行时数据池与上下文管理(TS),支持:

  • 命名空间 + KV 存取(自动添加 idooel 前缀避免冲突)
  • 可嵌套的上下文栈(覆盖读取)
  • 订阅变更(按 ns/key 过滤)
  • Vue 2.7+ 适配(插件 + useDataPool + usePoolValue)(可选)

安装

pnpm add @idooel/runtime-context

快速开始

核心功能

import { createDataPool } from '@idooel/runtime-context/core'

const pool = createDataPool()
// 命名空间操作(自动添加 idooel 前缀)
pool.set('user', 'token', 'abc')  // 实际存储为 'idooel.user'
pool.get('user', 'token')        // 'abc'

// 上下文隔离
const ctx = pool.createContext({ user: { tenant: 't1' } })
pool.runInContext(ctx, () => {
  pool.set('user', 'token', 'ctx-token') // 当前上下文
  pool.get('user', 'token') // 'ctx-token'
})

// 订阅变更
const off = pool.subscribe({ ns: 'user', key: 'token' }, (e) => {
  console.log('token changed:', e.value, 'actual ns:', e.ns) // 'idooel.user'
})
pool.set('user', 'token', 'xyz') // 触发订阅
off()

Vue 2 集成

import Vue from 'vue'
import { Vue2DataPoolPlugin } from '@idooel/runtime-context/vue2'

Vue.use(Vue2DataPoolPlugin)

// 在组件中使用
export default {
  created() {
    this.$idooelDataPool.set('user', 'token', 'abc')
    const token = this.$idooelDataPool.get('user', 'token')
  }
}

模块化导入

// 完整功能(核心 + Vue)
import { createDataPool, Vue2DataPoolPlugin } from '@idooel/runtime-context'

// 仅核心功能
import { createDataPool } from '@idooel/runtime-context/core'

// 仅 Vue 2 集成
import { Vue2DataPoolPlugin } from '@idooel/runtime-context/vue2'

特性

🔧 命名空间冲突避免

  • 所有命名空间自动添加 idooel 前缀(内部存储)
  • 避免与其他库或应用的全局数据冲突
  • 保持 API 一致性:用户使用的命名空间始终不带前缀
  • 订阅事件中的命名空间也保持用户友好的格式

📦 模块化设计

  • 核心库独立于框架
  • Vue 2 集成作为可选模块
  • 支持按需导入减少包体积

🎯 类型安全

  • 完整的 TypeScript 支持
  • 泛型类型推导
  • 编译时类型检查

更多用法见源码导出的类型与注释和 /examples 目录。

注意:

  • 当前版本未启用本地持久化。
  • 命名空间会自动添加 idooel 前缀(如 useridooel.user)。