JSPM

vite-plugin-userscript

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 892
  • Score
    100M100P100Q99036F
  • License MIT

Package Exports

  • vite-plugin-userscript
  • vite-plugin-userscript/dist/index.js
  • vite-plugin-userscript/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-userscript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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