Socket
Socket
Sign inDemoInstall

@damoclark/parcel-optimizer-userscript

Package Overview
Dependencies
102
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @damoclark/parcel-optimizer-userscript

Parcel optimiser plugin for bundling userscripts with the userscript metadata header


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
261 MB
Created
Weekly downloads
 

Readme

Source

parcel-optimizer-userscript

Overview

Parcel plugin for userscript development - adds the metadata header to your .user.js file.

Installation

npm install -D parcel @damoclarky/parcel-optimizer-userscript

In your package.json:

{
  "name": "Userscript Name",
  "version": "1.0.0",
  "description": "",
  "main": "dist/userscript.user.js",
  "source": "src/userscript.user.mjs",
  "scripts": {
    "watch": "npx parcel watch",
    "build": "npx parcel build src/userscript.user.mjs"
  },
  "devDependencies": {
    "@damoclarky/parcel-optimizer-userscript": "^0.0.1",
    "parcel": "^2.7.0"
  }
}

Then add the following config files:

.parcelrc

{
  "extends": "@parcel/config-default",
  "optimizers": {
    "*.user.{mjs,js,ts}": ["...", "@damoclarky/parcel-optimizer-userscript"]
  }
}

Where *.user.{mjs,js,ts} matches the filename for your main userscript file in your package.json.

.userscriptrc

{
  "userscriptMeta": "path/to/userscript.meta.js"
}

and userscriptMeta points to the file containing the metadata header for your userscript

Example for userscript.meta.js

// ==UserScript==
// @name        Userscript Name
// @namespace   https://userscript.com
// @description Description
// @include     https:/*
// @version     0.0.1
// @noframes
// @grant       none
// ==/UserScript==

Usage

While developing:

npx parcel watch --no-hmr

To produce final build:

npx parcel build src/userscript.user.mjs

Licence

MIT

Acknowledgements / Attribution

Original source code written by AKP Tools (https://github.com/akp-tools).

Keywords

FAQs

Last updated on 17 Nov 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc