vite-plugin-userscript
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

vite-plugin-userscript

Get Started

pnpm i -D vite-plugin-userscript
// vite.config.js

import { defineConfig } from 'vite';
import { metablock } from 'vite-plugin-userscript';

export default defineConfig({
  plugins: [
    metablock(),
  ],
  build: {
    lib: {
      entry: 'index.js',
      name: 'my-awesome-userscript',
    },
    rollupOptions: {
      output: {
        extend: true,
        format: 'umd',
        entryFileNames: 'my-awesome-userscript.user.js',
      },
    },
  },
});

Full options

metablock({
  // support json / json5 / yaml.
  file: './metablock.json',

  // show hints if you only want to write for specific script manager.
  manager: 'all',

  // dynamic override the meta from meta file
  override: {
    name: require('package.json').name
  },

  order: ['name', 'description', 'namespace', '...', 'grant'],

  // the action when meet invalid meta
  errorLevel: 'warn'

  // append metablock to which output files
  applyTo: /[.]user[.]js$/
})

Examples

See examples folder

License

MIT

Package Sidebar

Install

npm i vite-plugin-userscript

Weekly Downloads

234

Version

0.1.3

License

MIT

Unpacked Size

214 kB

Total Files

16

Last publish

Collaborators

  • flandredaisuki