Package Exports
- @damoclark/parcel-optimizer-userscript
- @damoclark/parcel-optimizer-userscript/lib/index.js
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 (@damoclark/parcel-optimizer-userscript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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-userscriptIn 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-hmrTo produce final build:
npx parcel build src/userscript.user.mjsLicence
MIT
Acknowledgements / Attribution
Original source code written by AKP Tools (https://github.com/akp-tools).