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

vite-plugin-geovis-oss

v1.0.0-beta.6

Published

上传静态资源到星图七牛云

Readme

vite-plugin-geovis-oss

一个 Vite 插件,用于将构建后的静态资源上传到星图七牛云对象存储。

特性

  • 🚀 自动上传构建后的静态资源到星图七牛云 OSS
  • 📁 保持目录结构,支持自定义远程路径
  • 🔒 安全的凭据管理(推荐使用环境变量)
  • 🛡️ TypeScript 类型支持

安装

npm install vite-plugin-geovis-oss -D
# 或
yarn add vite-plugin-geovis-oss -D
# 或
pnpm add vite-plugin-geovis-oss -D

使用方法

基本配置

// vite.config.js
import { defineConfig } from 'vite';
import vitePluginQiniuOSS from 'vite-plugin-geovis-oss';

export default defineConfig({
  plugins: [
    vitePluginQiniuOSS({
      // 必需参数
      accessKey: process.env.QINIU_ACCESS_KEY,
      secretKey: process.env.QINIU_SECRET_KEY,
    })
  ]
});

完整配置

// vite.config.js
import { defineConfig } from 'vite';
import vitePluginQiniuOSS from 'vite-plugin-geovis-oss';

export default defineConfig({
  plugins: [
    vitePluginQiniuOSS({
      // 必需参数
      accessKey: process.env.QINIU_ACCESS_KEY,
      secretKey: process.env.QINIU_SECRET_KEY,
      
      // 可选参数
      bucket: 'your-bucket-name',
      publicCdnPath: 'https://cdn.example.com', // CDN地址
      remoteFilePath: 'static/project-name',    // 远程路径
      uploadTarget: './dist',                   // 本地构建目录
      deleteOldFiles: false,                    // 删除旧文件(谨慎使用)
      excludeHtml: true,                        // 排除HTML文件
      excludeDirs: ['assets/images', 'public/icons'], // 排除的目录路径数组
    })
  ]
});

环境变量配置

创建 .env 文件:

QINIU_ACCESS_KEY=your_access_key_here
QINIU_SECRET_KEY=your_secret_key_here

配置选项

| 参数 | 类型 | 必需 | 默认值 | 描述 | |------|------|------|--------|------| | accessKey | string | ✅ | - | 星图七牛云 Access Key | | secretKey | string | ✅ | - | 星图七牛云 Secret Key | | bucket | string | ❌ | - | 星图七牛云存储空间名称 | | publicCdnPath | string | ❌ | - | CDN 基础地址 | | remoteFilePath | string | ❌ | '' | 远程服务器目录路径 | | uploadTarget | string | ❌ | config.build.outDir(默认 dist) | 本地打包目录路径(默认使用 Vite 的 outDir 配置) | | deleteOldFiles | boolean | ❌ | false | 是否删除已上传的旧文件 | | excludeHtml | boolean | ❌ | true | 是否排除 HTML 文件 | | excludeDirs | string[] | ❌ | [] | 排除的目录路径数组,支持目录名或 glob 模式 |

排除目录示例

vitePluginQiniuOSS({
  accessKey: process.env.QINIU_ACCESS_KEY,
  secretKey: process.env.QINIU_SECRET_KEY,
  excludeDirs: [
    'assets/images',      // 排除 assets/images 目录及其所有子文件
    'public/icons',       // 排除 public/icons 目录及其所有子文件
    'temp/**',            // 使用 glob 模式排除 temp 目录
  ]
})

注意事项

  1. 安全建议: 永远不要将 Access Key 和 Secret Key 硬编码在代码中,使用环境变量管理
  2. 权限配置: 确保使用的 Access Key 有足够的权限操作指定的存储空间
  3. 排除目录: excludeDirs 支持目录名(如 'assets')或 glob 模式(如 'assets/**'),会自动转换为 glob 模式进行匹配
  4. 谨慎删除: deleteOldFiles 选项会删除本地文件,请谨慎使用

许可证

MIT