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

@yh-ui/request

v1.0.9

Published

YH-UI HTTP request hooks - Enterprise-grade request management

Readme

@yh-ui/request

YH-UI 的 Vue 3 请求管理包。它基于 Fetch 和 Composition API,把请求实例、拦截器、重试、取消、缓存、SSE、AI Stream、分页、队列、GraphQL、WebSocket 和 HTTP 缓存协议整理成可组合的 API。

Documentation | GitHub

Highlights

  • 请求实例:RequestrequestcreateRequest 提供 baseURL、params、headers、timeout、retry、abort 和拦截器能力。
  • Vue Hooks:useRequestuseRequestSWRuseRequestPollingusePaginationuseLoadMore 处理页面常见数据状态。
  • 流式能力:useSSEuseAIStream 适合通知推送、日志输出和 AI 增量响应。
  • 并发控制:useQueueuseRequestQueue 用于限制并发、排队执行和管理批量任务。
  • 协议扩展:导出 adapters、cache、interceptors、graphql、websocket、http-cache,便于统一企业接口层。
  • TypeScript 友好:请求参数、响应数据、错误对象和 hook 返回值都有类型声明。

Install

pnpm add @yh-ui/request

Request Instance

import { createRequest } from '@yh-ui/request'

const api = createRequest({
  baseURL: '/api',
  timeout: 10000,
  retry: 2
})

api.interceptors.request.use((config) => {
  config.headers = {
    ...config.headers,
    Authorization: `Bearer ${getToken()}`
  }
  return config
})

const users = await api.get('/users')

useRequest

<script setup lang="ts">
import { createRequest, useRequest } from '@yh-ui/request'

interface User {
  id: number
  name: string
}

const api = createRequest({ baseURL: '/api' })

const { data, loading, error, refresh, run } = useRequest<User[]>(() => api.get<User[]>('/users'), {
  manual: false,
  onSuccess: (users) => console.log(users.length)
})
</script>

<template>
  <button :disabled="loading" @click="refresh">Refresh</button>
  <button @click="run()">Run</button>
  <pre v-if="error">{{ error.message }}</pre>
  <ul>
    <li v-for="user in data" :key="user.id">{{ user.name }}</li>
  </ul>
</template>

Streaming

import { useSSE } from '@yh-ui/request'

const { isConnected, connect, disconnect, error } = useSSE('/api/events', {
  reconnect: true,
  reconnectInterval: 3000,
  onMessage: (event) => {
    console.log(event.data)
  }
})

License

MIT