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

@coding-flow/flow-core

v0.0.7

Published

flow-engine core lib framework

Readme

@coding-flow/flow-core

Flow Engine 前端核心框架库,提供 HTTP 客户端、Hooks、Presenter 等基础能力(不包含 UI 组件)。

简介

flow-core 是 Flow Engine 的核心框架库,提供与 UI 无关的基础能力:

  • HTTP 客户端封装(基于 axios)
  • React Hooks 工具
  • Presenter 模式实现
  • 通用工具函数
  • 全局状态管理

依赖关系

  • 依赖: 无

Setup

安装依赖:

pnpm install

开发

构建库:

pnpm run build

监听模式构建:

pnpm run dev

核心功能

HTTP 客户端

基于 axios 封装的 HTTP 客户端,提供:

  • 请求拦截器/响应拦截器
  • 统一的错误处理
  • 类型安全的请求/响应
  • 请求取消支持
import { httpClient } from '@coding-flow/flow-core';

// GET 请求
const workflow = await httpClient.get<Workflow>('/api/workflows/1');

// POST 请求
const result = await httpClient.post<Workflow>('/api/workflows', workflowData);

React Hooks

提供常用的业务 Hooks:

  • useWorkflow - 工作流相关操作
  • useFlowRecord - 流程记录相关操作
  • useApproval - 审批相关操作
  • 自定义 Hooks 工具

Presenter 模式

实现业务逻辑与 UI 分离的 Presenter 模式:

import { Presenter } from '@coding-flow/flow-core';

class WorkflowPresenter extends Presenter {
  async loadWorkflow(id: string): Promise<Workflow> {
    // 加载工作流
  }

  async saveWorkflow(workflow: Workflow): Promise<void> {
    // 保存工作流
  }
}

工具函数

提供通用工具函数:

  • 日期格式化
  • 字符串处理
  • 对象深拷贝
  • 类型判断

模块结构

flow-core/
├── src/
│   ├── http/           # HTTP 客户端
│   ├── hooks/          # React Hooks
│   ├── presenter/      # Presenter 基类
│   ├── utils/          # 工具函数
│   └── types/          # 基础类型定义
└── README.md

使用示例

import { httpClient, useWorkflow, WorkflowPresenter } from '@coding-flow/flow-core';

// 使用 HTTP 客户端
const workflows = await httpClient.get<Workflow[]>('/api/workflows');

// 使用 Hooks
const { data, loading, error } = useWorkflow('wf-001');

// 使用 Presenter
const presenter = new WorkflowPresenter();
await presenter.loadWorkflow('wf-001');

Learn more