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

@pactor-app/runtime

v1.20.0

Published

Pactor runtime: RuntimeContext, StateStore, DataSource runtime, action engine, React renderer and page runtime

Downloads

2,692

Readme

@pactor-app/runtime

Pactor 的运行时引擎包:把 PageDsl 运行起来——RuntimeContext 组装、StateStore、DataSource 运行时、Action 引擎、React Renderer 与 PageRuntime 完整链路。

安装

npm install @pactor-app/runtime react
# 或
pnpm add @pactor-app/runtime react

react >= 18 为 peer dependency。非 React 部分(context / state / datasource / action)零 React 依赖,可脱离 React 单独使用与测试。

示例

import { createPageRuntime, PageRuntimeView } from '@pactor-app/runtime';

const runtime = createPageRuntime(pageDsl, {
  // 可选:注入自定义 Registry / Adapter
  // services / components / permission / router / http ...
});

// 注册组件与服务
runtime.context.components.register('Button', Button);
runtime.context.services.register('customer.list', async (params) => fetchList(params));

await runtime.initialized; // autoLoad + onInit + onLoad 完成

// React 渲染入口
<PageRuntimeView runtime={runtime} />;

// 宿主(Router)触发生命周期
await runtime.show();
await runtime.destroy();

功能一览

  • RuntimeContextcreateRuntimeContext(options) 组装 app / page / state / data / route / user / services / components / actions / permission / capabilities,支持注入自定义 Registry 与 Adapter(permission 默认放行、navigate 默认 no-op、http 默认基于全局 fetch,可替换)。
  • StateStore:框架无关的最小状态容器,getState() / get('a.b.c') / set(patch) / set('a.b', v) / reset() / subscribe(),全部不可变更新。
  • DataSource 运行时static / service / http 三种类型,autoLoadloading / error / data 状态、params 表达式求值、refresh(name) / reload(name?);错误写入 error 状态,不抛到渲染层。
  • Action 引擎condition 跳过 → permission 拦截 → Registry 执行的管线,全程受控返回 { ok, data?, error?, skipped? };内置 UI 无关动作 setState / resetState / reload / request / sequence / parallel / if / delay
  • React Renderer<DslRenderer> 递归渲染 DSL 树——props 深度表达式解析、when 条件渲染、events 绑定(事件对象注入 event 作用域)、未注册组件渲染 UnsupportedComponent 占位、withScope 子作用域机制(useRenderer().renderChildren(children, { row, rowIndex }))。
  • PageRuntimecreatePageRuntime(pageDsl) 完成 校验(失败抛 PageRuntimeError)→ 上下文组装 → autoLoad → 生命周期的完整链路。

文档

完整文档见 https://github.com/426-330/pactor/tree/main/docspnpm docs:dev 本地启动文档站)。

License

MIT