lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.33k stars 70 forks source link

[功能请求] 增加一个输出 .meta.js 的构建选项 #15

Closed Tsuk1ko closed 2 years ago

Tsuk1ko commented 2 years ago

.meta.js 只会包含 UserScript 注释,不包含代码正文,Tampermonkey 等脚本插件会自动使用该文件检查脚本更新而不必下载完整脚本,Greasy Fork 等脚本托管网站也会自动提供该文件(可以随便找个脚本链接把 .user.js 替换为 .meta.js 访问看看)

如果是使用 Github Pages 等托管脚本的话,自动生成 .meta.js 会很有用

lisonge commented 2 years ago

原来还有这种,可以增加

lisonge commented 2 years ago

finished by https://github.com/lisonge/vite-plugin-monkey/blob/v2.1.1/packages/vite-plugin-monkey/CHANGELOG.md#211-features

docs see https://github.com/lisonge/vite-plugin-monkey/blob/v2.1.1/packages/vite-plugin-monkey/src/node/index.ts#L97-L107

{
  build: {
    metaFileName:true, // 默认为 false,需要手动开启
    // or
    metaFileName: 'xxx.meta.js',
  }
}