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

naiad-router

v0.6.6

Published

此项目是 react 实现 vue 的 keepalive 的项目。主要针对中后台系统中,用户希望同时看到几个页面的情景。同时搭配 naiad-admin 使用有良好的体验。 安装此项目不需要安装 react-router 7,此项目将常用的方法暴露出来,以免出现版本的冲突。

Readme

naiad-router

此项目是 react 实现 vue 的 keepalive 的项目。主要针对中后台系统中,用户希望同时看到几个页面的情景。同时搭配 naiad-admin 使用有良好的体验。 安装此项目不需要安装 react-router 7,此项目将常用的方法暴露出来,以免出现版本的冲突。

此项目原理简单,利用 Map 对象进行缓存控制,display 进行显隐展示。

此项目可以通过模式切换,tabsroutes。如果选 routes 是正常 react-router 7 的模式。 如果选择 tabs 则是类似于 vue 的 keepalive 的模式。

使用方法

如果选择tabs模式。

const routerConfig = {
  page: {
    "/a1": {
      path: "/a1",
      loader: () => import("./A1"),
      label: "a1",
    },
  },
  content: {
    "/a2": {
      path: "/a2",
      loader: () => import("./a2"),
      label: "a2",
    },
    "/a2/b1": {
      path: "/a2/b1",
      loader: () => import("./a2/b1"),
      label: "b1",
    },
  },
};

<NaiadRouter mode="tabs" layout={<A0 />} routerConfig={routerConfig} />;

此时需要传递三个参数,模式选择 layout 组件 和 路由配置。这里因为针对中后台系统开发,所以默认需要布局组件。

如果选择routes模式。

const routes = createBrowserRouter([{...}])
   <NaiadRouter mode="routes" router={routes} />

与 react-router 7 的用法一致。

新功能

增加入口路径和 404 页面。 入口路径可以理解为重定向,因为进入后默认是 / 路径,所以需要重定向到某个具体页面比如说/home 。 如果在 tabs 模式下,有找不到的页面,重新打开了一个页面,此时不是很友好,所以将 404 页面配置到页签里,可以提升用户体验。

const routerConfig = {
  enter: "/home",
  notFound: "/404",
  page: {
    "/login": {
      path: "/login",
      loader: () => import("./login"),
      label: "登录",
    },
  },
  content: {
    "/home": {
      path: "/home",
      loader: () => import("./home"),
      label: "首页",
    },
    "/home/search": {
      path: "/home/search",
      loader: () => import("./home/search"),
      label: "搜索",
    },
    "/404": {
      path: "/404",
      loader: () => import("./notFound"),
      label: "找不到",
    },
  },
};

当然你也可以使用传统的方式,在路由配置中加入一个 404 的页面。

const routerConfig = {
  enter: "/home",

  page: {
    "/login": {
      path: "/login",
      loader: () => import("./login"),
      label: "登录",
    },
    "*": {
      path: "*",
      loader: () => import("./notFound"),
    }, //此时会打开一个新的404页面,不在页签之内
  },
  content: {
    "/home": {
      path: "/home",
      loader: () => import("./home"),
      label: "首页",
    },
    "/home/search": {
      path: "/home/search",
      loader: () => import("./home/search"),
      label: "搜索",
    },
  },
};

日志

0.6.5
  1. 完成 tabs 样式的修改,加入鼠标移入后自动 tab 自动左右移动。
  2. 增加入口路径和 404 页面
0.5.0

新增:区分 tabs 中的 page 和 content 两种页面,page 不加入缓存且不存放至 layout 组件中,content 加入缓存。