{"_id":"@0xdv/webpack-userscript","_rev":"2-ff9905c5968abbbdb4bff710b698aa5c","name":"@0xdv/webpack-userscript","dist-tags":{"latest":"2.3.2"},"versions":{"2.3.1":{"name":"@0xdv/webpack-userscript","version":"2.3.1","description":"A Webpack4+ plugin for userscript projects.","repository":{"type":"git","url":"git+https://github.com/0xdv/webpack-tampermonkey.git"},"main":"lib/index.js","scripts":{"commit":"gitmoji -c","lint":"eslint './**/*.js'","test":"tape test/**/*.test.js","release":"semantic-release"},"keywords":["webpack","userscript","tampermonkey","greasemonkey"],"author":{"name":"MomoCow"},"license":"MIT","bugs":{"url":"https://github.com/0xdv/webpack-tampermonkey/issues"},"homepage":"https://github.com/0xdv/webpack-tampermonkey#readme","devDependencies":{"@semantic-release/git":"^7.0.16","eslint":"^5.15.3","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-promise":"^4.0.1","eslint-plugin-standard":"^4.0.0","gitmoji-cli":"^1.9.2","memory-fs":"^0.4.1","semantic-release":"^15.13.18","semantic-release-gitmoji":"^1.3.2","tape":"^4.10.1","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"peerDependencies":{"webpack":"^4.0.0"},"dependencies":{"@tkausl/userscript-meta":"^1.0.2","schema-utils":"^1.0.0","webpack-sources":"^1.3.0"},"gitHead":"aa1fdee4df6b2c8f336b6a35c3bcc6456f0797a5","_id":"@0xdv/webpack-userscript@2.3.1","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-IFleiPwj8uy0TF8kpeIByPztOqtM3uWMSjU2ktmCfcXXMi2hFyjtKr2sq5a62axbOU+ZB+xmZR2lm/uxnwWXYQ==","shasum":"9d295ad8b1c5da3c962c219497bcf652d5d2d5f5","tarball":"https://registry.npmjs.org/@0xdv/webpack-userscript/-/webpack-userscript-2.3.1.tgz","fileCount":9,"unpackedSize":16543,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4CwJCRA9TVsSAnZWagAAoDsP/jhMpauI7htnmPR+JzCP\nwAa/Wr+ss4XaOjM12I5pPuIKX2RkOhP7EY+jUyjGoV5JIycoiRYKuVIjlQfr\nrV2yFl/5G1xixN1rmoUruHA/DIXOtohpgCXYdFZ8PhV+0FIE5y4m6XwJd3or\nGVaUKFF2GfKhOng+74Cf3jdpn0bCLNU33X13wbUQXM8N87IamSo4pDgHN6NC\n8nlIAhEBdtgX+Vr6iUa9d7BFkCaUO+2sPRVyXFAnGcI/RszgIZUMFqdqL4Pu\n04vTnnNYFlVmORF7/orbL2rgOQ1cuLE2LJ3vyQr+7/cbQSOO2iFCV6rOk6KH\nIqhPgINPTuKRPeC+0ZB/WHdMDkkTvsSxsRRaiuQqaZYEhjy0KAXjkh92fn/M\nhLO7qI/Y5JjwYaACqGcuL/0FwR7pyCcoXpHEK/vSJeVJ9eBJsc7iWEm80kZ0\nxQbpE/XwC/mmeHqvIofUX05Q0pbSj8vYvts25R+XW8opuklfbhxouhlqV4Jy\nxFTc1rCl/Wf0Pm1RDCX6a6SEmlS2Aho1/BDXztNKXErXB18aN45GZTqvRwEj\nlBxwvGkyibXhiEPSGO0Y2sL+wLcNqifG531Wbx5DrldRurwTA6lShjJoY/Rf\nDmcA/Yk5tpnPCDqZIFLiSN/tuMnaqe+pDk0AXa6yYGgHVDgbXkX06/7zGQOl\nA+tm\r\n=plAo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEuxAROmEJ5RIRx9xxeSiILAC2cuC7UkmLg6Vph0tdURAiBXTYmGQVNH2wQK36KBSEjZDidos7cvso6egaCaOo1USg=="}]},"maintainers":[{"name":"0xdv","email":"0xdv.0xdv@gmail.com"}],"_npmUser":{"name":"0xdv","email":"0xdv.0xdv@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-userscript_2.3.1_1574972424691_0.6065333407943705"},"_hasShrinkwrap":false},"2.3.2":{"name":"@0xdv/webpack-userscript","version":"2.3.2","description":"A Webpack4+ plugin for userscript projects.","repository":{"type":"git","url":"git+https://github.com/0xdv/webpack-userscript.git"},"main":"lib/index.js","scripts":{"commit":"gitmoji -c","lint":"eslint './**/*.js'","test":"tape test/**/*.test.js","release":"semantic-release"},"keywords":["webpack","userscript","tampermonkey","greasemonkey"],"author":{"name":"MomoCow"},"license":"MIT","bugs":{"url":"https://github.com/0xdv/webpack-userscript/issues"},"homepage":"https://github.com/0xdv/webpack-userscript#readme","devDependencies":{"@semantic-release/git":"^7.0.16","eslint":"^5.15.3","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-promise":"^4.0.1","eslint-plugin-standard":"^4.0.0","gitmoji-cli":"^1.9.2","memory-fs":"^0.4.1","semantic-release":"^15.13.18","semantic-release-gitmoji":"^1.3.2","tape":"^4.10.1","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"peerDependencies":{"webpack":"^4.0.0"},"dependencies":{"@tkausl/userscript-meta":"^1.0.2","schema-utils":"^1.0.0","webpack-sources":"^1.3.0"},"gitHead":"aa1fdee4df6b2c8f336b6a35c3bcc6456f0797a5","_id":"@0xdv/webpack-userscript@2.3.2","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-tr2JM6KW6GRepCp7vCnF0Fp9+bi78U4xvegbURv8v5RJ5an58d7OW+VHAeLMNMBa1zx0rhCepmo/vP7CyQBZZQ==","shasum":"2f4d6b9ddbe0f5e6441c60424d743faf9a9b5329","tarball":"https://registry.npmjs.org/@0xdv/webpack-userscript/-/webpack-userscript-2.3.2.tgz","fileCount":9,"unpackedSize":16537,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4X3ACRA9TVsSAnZWagAAze0P/R6V9yyOVSSdqi6yB2MD\nkXImF+Qdl+rYC7OkZS6jMklq8+m7rU0d/afdA2QsLmScDEp2VF9hxO7basH0\nOOFfZWEckypQVPnZ8MZwW8eore5hKpFmq1Cvt86ZPfGlM+Pqm2966Vb+uwL3\n5bqX3obHXPHwGgUXtXSWFJ1XrFH7Rw8wMPC2kR1CFK8MftDFRK2hP/RriBX8\nhEjzUgcc+lmD2wSU7lJJEdgNc6JYGxpZZOP04yiERw6xZMN3vVxg6IkSR9jN\npkQsZq9dSIn9a+UWBHDzYZH4uJfNgJ1ePNIcqcz3LKnqq+6ccHbH0gDC5K2s\nTjnAeUJk4zr4KMTkPuD8NSSSynYt376VGeUhWCoiHZ9zEQaxy12719exjVCD\nDtqu3NiENTrKV2cDtH/IHItuXom+tkqAmO889LSGcbG2i0lyWHAYA6T7RCfy\naA51mthh8V41aUef26pSMHabtJ6UU5X3DaGai9XmpF0a/vhYJKckIB0qWObN\n9D8ROVVMMnGzrsaGqq3GU4nQjh4wJxNa4/ngI0z4PjWJV5n7KOmFV64A2gf9\ntCIq8QVVcWvppcGVojyN5GZDz4M9BhCB8UROkDuoj6w7Pgfc6qMiGcwYoXEX\n3q2hqyxaoIgldwOTQkdjGJFqXSD0fuz1lF+wCLHsrVBhmIoke8C76xHdDAMa\ngiUb\r\n=R2D8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPwK7vMmpN2wZ/GGzC1goBTyTWHzSZlBsRvixufDrn/gIgO06aRlRZuqkockuXp9ZzThudt+GWalMlK/xhjnOh/gI="}]},"maintainers":[{"name":"0xdv","email":"0xdv.0xdv@gmail.com"}],"_npmUser":{"name":"0xdv","email":"0xdv.0xdv@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-userscript_2.3.2_1575058880381_0.6439432791482649"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-28T20:20:24.461Z","2.3.1":"2019-11-28T20:20:24.802Z","modified":"2022-04-04T10:28:55.919Z","2.3.2":"2019-11-29T20:21:20.510Z"},"maintainers":[{"name":"0xdv","email":"0xdv.0xdv@gmail.com"}],"description":"A Webpack4+ plugin for userscript projects.","homepage":"https://github.com/0xdv/webpack-userscript#readme","keywords":["webpack","userscript","tampermonkey","greasemonkey"],"repository":{"type":"git","url":"git+https://github.com/0xdv/webpack-userscript.git"},"author":{"name":"MomoCow"},"bugs":{"url":"https://github.com/0xdv/webpack-userscript/issues"},"license":"MIT","readme":"# webpack-userscript\n[![Build Status](https://travis-ci.org/momocow/webpack-userscript.svg?branch=master)](https://travis-ci.org/momocow/webpack-userscript)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![npm](https://img.shields.io/npm/v/webpack-userscript.svg)](https://www.npmjs.com/webpack-userscript)\n[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)](https://gitmoji.carloscuesta.me/)\n\nA Webpack4+ plugin for userscript projects. 🙈\n\n> The package has been renamed from `webpack-tampermonkey`.\n\n## Features\n- Combine your userscript development with Webpack\n  > With powerful Webpack support, you can even package everything in your userscript, e.g. icons and json data.\n- Ability to generate userscript headers\n- Ability to generate both `.user.js` and `.meta.js`\n  > `.meta.js` is used for update check containing headers only.\n- Properly track files in watch mode\n  > Including external header files and package.json.\n\n## Installation\n```bash\nnpm i webpack-userscript -D\n```\n\n## Usage\n\n### webpack.config.js\n\nInclude the plugin in the `webpack.config.js` as the following example.\n\n```js\nconst WebpackUserscript = require('webpack-userscript')\n\nmodule.exports = {\n  plugins: [\n    new WebpackUserscript()\n  ]\n}\n```\n\n## Examples\n\n### Hot Development\nThe following example can be used in development mode with the help of [`webpack-dev-server`](https://github.com/webpack/webpack-dev-server).\n\n`webpack-dev-server` will build the userscript in **watch** mode. Each time the project is built, the `buildNo` variable will increase by 1.\n\nIn the following configuration, a portion of the `version` contains the `buildNo`; therefore, each time there is a build, the `version` is also increased so as to indicate a new update available for the script engine like Tampermonkey or GreaseMonkey.\n\nAfter the first time starting the `webpack-dev-server`, you can install the script via `http://localhost:8080/<project-name>.user.js` (the URL is actually refered to your configuration of `webpack-dev-server`). Once installed, there is no need to manually reinstall the script until you stop the server. To update the script, the script engine has an **update** button on the GUI for you.\n\n- `webpack.config.dev.js`\n```js\nconst path = require('path')\nconst WebpackUserscript = require('webpack-userscript')\nconst dev = process.env.NODE_ENV === 'development'\n\nmodule.exports = {\n  mode: dev ? 'development' : 'production',\n  entry: path.resolve(__dirname, 'src', 'index.js'),\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '<project-name>.user.js'\n  },\n  devServer: {\n    contentBase: path.join(__dirname, 'dist')\n  },\n  plugins: [\n    new WebpackUserscript({\n      headers: {\n        version: dev ? `[version]-build.[buildNo]` : `[version]`\n      }\n    })\n  ]\n}\n```\n\n### Other\nOther examples can be found under [the test fixture folder](./test/fixtures).\n\n## Configuration\n### WebpackUserscript\nThe `WebpackUserscript` constructor has the following signature.\n```js\nnew WebpackUserscript(options)\n```\n\n### options\n> Also see [the schema of options](./lib/schemas/options.json).\n\n```ts\ntype WebpackUserscriptOptions =\n  WPUSOptions |\n  HeaderFile |   // shorthand for WPUSOptions.headers\n  HeaderProvider // shorthand for WPUSOptions.headers\n```\n\n#### WPUSOptions\n```ts\ninterface WPUSOptions {\n  headers: HeaderFile | HeaderProvider | HeaderObject\n\n  /**\n   * Output *.meta.js or not\n   */\n  metajs: boolean\n\n  /**\n   * Rename all .js files to .user.js files.\n   */\n  renameExt: boolean\n\n  /**\n   * Prettify the header\n   */\n  pretty: boolean\n}\n```\n\n#### HeaderFile\nA path to a js or json file which exports a header object or a header provider function.\n\n```ts\ntype HeaderFile = string\n```\n\n#### HeaderProvider\nA function that returns a header object.\n\n```ts\ntype HeaderProvider = (data: DataObject) => HeaderObject\n```\n\n#### HeaderObject\nA header object, whose leaves are webpack-like template strings in `[<var_name>]` format. Available variables can be found at [DataObject](#dataobject).\n\n> Also see [explicit-config/webpack.config.js](./test/fixtures/explicit-config/webpack.config.js#L13) and [template-strings/webpack.config.js](./test/fixtures/template-strings/webpack.config.js#L16).\n\n```ts\ntype HeaderObject = Record<string, string | Array<string>>\n```\n\n#### DataObject\nLocal variables used to interpolate the templates of a [HeaderObject](#headerobject).\n\n```ts\ninterface DataObject {\n  /**\n   * Hash of Webpack compilation\n   */\n  hash: string\n\n  /**\n   * Webpack chunk hash\n   */\n  chunkHash: string\n\n  /**\n   * Webpack chunk name\n   */\n  chunkName: string\n\n  /**\n   * Entry file path, which may contain queries\n   */\n  file: string\n\n  /**\n   * Query string\n   */\n  query: string\n\n  /**\n   * Build number\n   */\n  buildNo: number\n\n  /**\n   * Info from package.json\n   */\n  name: string\n  version: string\n  description: string\n  author: string\n  homepage: string\n  bugs: string // URL\n}\n```\n\n> Also see [template-strings/webpack.config.js](./test/fixtures/template-strings/webpack.config.js#L16).\n","readmeFilename":"README.md"}