使用 Deno 打包 Tampermonkey/Userscript 脚本的工具。
deno run -A jsr:@g9wp/gm-bundle -b userscript_main.ts| 参数 | 别名 | 说明 | 默认值 |
|---|---|---|---|
--metafile |
-m |
包含 // ==UserScript== 注释块的元文件路径 |
默认为 --bundle |
--bundle |
-b |
打包文件的入口 | - |
--wrap |
-w |
打包 iife 格式独立脚本 | true |
--output |
-o |
输出文件路径 | 默认为 --bundle 的 .user.js 扩展名 |
# 指定入口文件进行打包
deno run -A jsr:@g9wp/gm-bundle -b src/main.ts
# 指定元文件和输出文件
deno run -A jsr:@g9wp/gm-bundle -m header.meta -b src/main.ts -o dist/script.user.js
# 禁用 iife 包装
deno run -A jsr:@g9wp/gm-bundle -b main.ts -w false