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

@xysfe/vite-plugins

v1.0.3

Published

A collection of Vite plugins — multi-origin CDN injection and more

Readme

@xysfe/vite-plugins

npm version license

Vite 插件合集,提供多环境部署、CDN 域名注入等能力。

📦 包含的插件

| 插件 | 说明 | | --- | --- | | VitePluginMultiOrigin | 多环境 CDN 域名动态注入,通过 PHP 模板变量 {$CDN} 实现运行时动态 CDN 域名 | | VitePluginDevProxy | 开发环境远程代理,自动代理远程 HTML/API、注入本地入口脚本、处理 Cookie/重定向 | | VueCliPluginDevProxy | Vue CLI 版开发代理,功能同上,适配 Vue CLI devServer.proxy |

📦 安装

npm install @xysfe/vite-plugins -D
# or
yarn add @xysfe/vite-plugins -D
# or
pnpm add @xysfe/vite-plugins -D

🚀 使用

import { defineConfig } from 'vite'
import { VitePluginMultiOrigin } from '@xysfe/vite-plugins'

export default defineConfig({
  base: '//sslstatic.xiaoyusan.com/shouhuitech/shouxiaobao',
  plugins: [
    VitePluginMultiOrigin({
      cdnPlaceholder: '{$CDN}',
      regex: ['xiaoyusan.com'],
      shouldCheck: true,
      fixedPublicPath: false,
      debug: true,
    }),
  ],
})

📚 插件配置

VitePluginMultiOrigin

| 参数 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | cdnPlaceholder | string | '{$CDN}' | PHP 模板变量,服务端渲染时替换为实际 CDN 域名 | | regex | string[] | ['xiaoyusan.com'] | 合规检测正则数组 | | shouldCheck | boolean | true | 是否开启合规检测 | | fixedPublicPath | boolean | false | 保持原 base(dev/SSR 场景) | | monitorInclude | string | '' | 注入 HTML 的 PHP include 片段 | | debug | boolean | false | 调试模式 |

VitePluginDevProxy

| 参数 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | appHost | string | - | 必填。远程服务器地址,如 'example.com' | | https | boolean | true | 是否使用 HTTPS 协议 | | staticPrefix | string | '/dev/static' | 静态资源路径前缀,必须以 / 开头 | | remotePrefixes | string \| string[] \| Function \| RegExp | ['/static/component'] | 远程资源路径规则 | | clearScriptCssPrefixes | string \| string[] \| Function \| RegExp | '' | 清除远程 HTML 中脚本/样式的规则 | | entry | string \| string[] | '/src/main.js' | 本地入口文件路径 | | developmentAgentOccupancy | string | '' | 自定义占位符,用于替换为入口脚本 | | localIndexHtml | string | '' | 本地 HTML 文件路径(库模式) | | debug | boolean | false | 调试模式 |

VueCliPluginDevProxy

VitePluginDevProxy,适配 Vue CLI devServer.proxy,默认 entry['/js/chunk-vendors.js', '/js/app.js']

📁 项目结构

src/
├── plugins/
│   ├── multi-origin.ts         # 多 CDN 域名插件
│   └── dev-proxy/              # 开发环境远程代理
│       ├── core.ts             # 核心共享逻辑(类型/工具函数/HTTP处理)
│       ├── vite-cli.ts         # Vite 插件
│       ├── vue-cli-plugin.ts   # Vue CLI 插件
│       └── index.ts            # 子入口
└── index.ts                    # 根入口,re-export 所有插件

新增插件:在 src/plugins/ 下创建文件,在 src/index.ts 中 re-export。

📄 许可证

MIT License © 2024