Prepends ViolentMonkey headers to your rollup bundle
npm install rollup-plugin-violent-monkey> rollup-plugin-violent-monkey is actively being developed. The API is rapidly changing and considered unstable. Install or upgrade at your own risk!
Looking for a simple development environment? Have a look at vite-violent-monkey.
options object to the plugin. Works with TypeScript or JavaScript including type completion and validation.defineMetadata.GM_ & GM.* API supported by ViolentMonkey.* Add @require fields based on code imports, excluding type imports.
``shnpm
npm i -D rollup-plugin-violent-monkey
$3
`ts
// vite.cofig.ts
import { defineConfig } from "vite";
import { plugin as violentMonkey } from "rollup-plugin-violent-monkey";export default defineConfig({
build: {
rollupOptions: {
plugins: [violentMonkey({
// add your script metadata here
//...
})],
},
},
});
`$3
`ts
// rollup.config.js
import { plugin as violentMonkey } from "rollup-plugin-violent-monkey";export default {
plugins: [violentMonkey({
// add your script metadata here
//...
})],
};
`$3
`ts
// violentmonkey.metadata.ts or violentmonkey.metadata.js
import { defineMetadata } from "rollup-plugin-violent-monkey";export default defineMetadata({
name: "My Violent Script",
downloadUrl: "github.com/myviolentscriptgist.js",
grants: ["GM_addElement", "GM.addStyle", "window.focus"],
});
`Then import it in your Rollup or Vite config:
`ts
// vite.config.ts
import { defineConfig } from "vite";
import { plugin as violentMonkey } from "rollup-plugin-violent-monkey";import metadata from "./violentmonkey.metadata"
export default defineConfig({
build: {
rollupOptions: {
plugins: [violentMonkey(metadata)],
},
},
});
``js
// rollup.config.js
import { plugin as violentMonkey } from "rollup-plugin-violent-monkey";import metadata from "./violentmonkey.metadata"
export default {
plugins: [violentMonkey(metadata)],
};
`$3
Create a
.d.ts file in the root of your source directory, and add the following:`ts
///
``