🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

rollup-plugin-monkey

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-monkey

rollup plugin for GM_Script

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

rollup-plugin-monkey

release npm

使用 rollup 开发「GM_脚本」

git: https://github.com/wdssmq/rollup-plugin-monkey

npm: https://www.npmjs.com/package/rollup-plugin-monkey

相对不重要的外部链接

关于本项目的博文链接,以及 B 站视频演示;

点击这里查看

「言说」写了份有点「大」的代码_杂七杂八_沉冰浮水:

https://www.wdssmq.com/post/20190704011.html

「折腾」使用 rollup.js 模块化编写 GM 脚本_电脑网络_沉冰浮水:

https://www.wdssmq.com/post/20120627834.html

「小代码」rollup.js 开发「GM_脚本」演示_哔哩哔哩_bilibili:

https://www.bilibili.com/video/BV1qe4y1d7ZM

已知问题

  • pnpm 下的正确姿势需要进一步探究;
  • @require 引入的函数库无法在开发模式下访问;

安装使用

  • 下载「初始模板」文件并解压;「点击这里下载
  • 修改文件夹名为你的项目名;
  • 进入项目文件夹后执行 cpnm i 安装依赖;「pnpm 目前还有点问题?」
  • 「userscript header」由src/__info.js定义,以字符串形式;「这是和其他同类工具最大的不同」
    • 还有一个gm_name常量建议修改为和文件夹名一样;
  • 可用命令:
    • npm run dev
    • npm run build
    • npm run clear
  • 预置了src/main.jssrc/_base.js用于实际「GM_脚本」功能编写,可自行修改或增加文件;
  • 你可以维护一份自己的「初始模板」,主要是src/__info.jssrc/_base.js
  • 本人习惯原因,正式文件会输出在项目根目录,由rollup.config.mjs内定义:
    • 可自行修改:gm_file: `${gm_name}.user.js`,gm_file: `dist/${gm_name}.user.js`,
PROJECT_SCRIPT=script_demo
# 下载初始模板
wget https://github.com/wdssmq/rollup-plugin-monkey/releases/latest/download/script_def.tar.gz
tar -xzvf script_def.tar.gz
mv script_def ${PROJECT_SCRIPT}
cd ${PROJECT_SCRIPT}
cnpm i

# 修改 src/__info.js 内常量定义

# 运行
npm run dev

截图演示(点击展开)

doc-001.png

CSP

Edge 插件:Disable Content-Security-Policy

参考项目

lisonge/vite-plugin-monkeyhttps://github.com/lisonge/vite-plugin-monkey
pearofducks/rollup-plugin-devhttps://github.com/pearofducks/rollup-plugin-dev
thgh/rollup-plugin-livereloadhttps://github.com/thgh/rollup-plugin-livereload

Keywords

rollup

FAQs

Package last updated on 20 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts