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

vue-rex

v1.1.18

Published

Vue Rex 是一个面向 Vue 3 的高度灵活、类型安全且插件化的请求 Hook 库,支持多后端适配、缓存、分页、插件化扩展等特性。

Readme

特性

  • 工厂函数模式 — 通过 createRequest / createPagination 创建可复用的请求实例
  • 类型自动推导 — TypeScript 根据 service 返回类型自动推导 data 类型
  • 多后端适配 — 通过 dataKey / listKey + totalKey 统一不同后端的数据结构
  • 缓存策略 — 内置内存缓存,支持 staleTime / cacheTime 配置
  • 轮询请求 — 自动定时重新请求
  • 错误重试 — 支持配置重试次数和间隔
  • 防抖 / 节流 — 内置请求防抖和节流
  • 分页管理 — 自动管理 page / pageSize 状态
  • 插件化 — 支持自定义插件扩展
  • 全局配置 — 支持全局默认配置和插件注入

安装

npm install vue-rex
# or
pnpm add vue-rex
# or
yarn add vue-rex

快速开始

createRequest

import { createRequest } from 'vue-rex'

// 创建实例,dataKey 指定数据提取路径
const useApi = createRequest({ dataKey: 'data' })

// 组件中使用
const getUserList = async () => {
  const res = await fetch('/api/users')
  return res.json() // { code: 0, data: User[] }
}

const { data, loading, error, run } = useApi(getUserList)
// data.value 自动推导为 User[] 类型 ✅

createPagination

import { createPagination } from 'vue-rex'

// 创建分页实例
const usePage = createPagination({
  listKey: 'data.records',
  totalKey: 'data.total',
})

// 组件中使用
const getUserPage = async (params: { page: number; pageSize: number }) => {
  const res = await fetch(`/api/users?page=${params.page}&size=${params.pageSize}`)
  return res.json()
}

const { list, total, page, pageSize, run } = usePage(getUserPage)
// list.value 自动推导为 User[] 类型 ✅
// page / pageSize 是可写的 Ref,变化时自动触发请求

文档

文档地址 (GitHub)

致谢