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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@anov/hot-reload

v1.0.3

Published

用于ANOV-DEV框架的Vite插件

Readme

@anov/hot-reload

用于 Anov 框架的 Vite 插件,提供便捷的热重载等功能。

Vue 组件自动热重载插件

这个插件为 Vue 3 组件提供了增强的热模块替换(HMR)功能,使组件能够在修改后保持状态并正确重新初始化。

特性

  • 支持组合式 API(<script setup>)和选项式 API 组件
  • 懒加载模式:只有组件被路由加载时才注入热重载代码
  • 通过全局注册表跟踪组件实例
  • 精确注入代码而不影响原有逻辑
  • 提供开发者调试工具
  • 生产环境自动禁用,零性能影响
  • 智能检测:如果组件已定义同名方法,会优先使用组件的方法而不重复声明
  • 完全支持 TypeScript:自动检测组件语言类型并保持一致性
  • 兼容现有代码:智能处理已存在的 defineExpose,避免重复声明
  • 避免导入冲突:自动检测组件已导入的 Vue 函数,避免重复导入
  • 尊重单文件组件规范:将热重载代码集成到现有 script 标签,而不是添加新标签

安装

npm install @anov/hot-reload --save-dev

用法

在你的 Vite 配置文件中:

// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vueInitHotReload } from '@anov/vite-plugins'

export default defineConfig({
  plugins: [
    vueInitHotReload({
      method: 'init' // 指定重载方法名
    }),
    vue()
    // 其他插件...
  ]
})

配置选项

| 选项 | 类型 | 默认值 | 说明 | | ------ | ------ | ------ | ------------ | | method | string | 'init' | 热重载方法名 |

工作原理

  1. 组合式 API 注入:

    • <script setup>组件中自动注入init方法和全局注册逻辑
    • 通过defineExpose暴露init方法供热重载使用
  2. 选项式 API 注入:

    • 在组件选项中添加init方法和mounted钩子
    • mounted钩子中注册组件到全局管理表
  3. 热更新处理:

    • 监听组件更新事件
    • 通过全局注册表找到组件实例并调用其init方法