mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
657
web/node_modules/html-webpack-plugin/CHANGELOG.md
generated
vendored
Normal file
657
web/node_modules/html-webpack-plugin/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,657 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
# [4.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.1...v4.5.0) (2020-09-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add publicPath option to overrule the default path generation ([#1516](https://github.com/jantimon/html-webpack-plugin/issues/1516)) ([19b5122](https://github.com/jantimon/html-webpack-plugin/commit/19b5122))
|
||||
* update webpack dependency range to allow installing webpack 5 beta ([f3ccdd5](https://github.com/jantimon/html-webpack-plugin/commit/f3ccdd5)), closes [#1504](https://github.com/jantimon/html-webpack-plugin/issues/1504)
|
||||
|
||||
|
||||
|
||||
## [4.4.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.0...v4.4.1) (2020-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* broken typings.d.ts in v4.4.0 ([#1503](https://github.com/jantimon/html-webpack-plugin/issues/1503)) ([98ad756](https://github.com/jantimon/html-webpack-plugin/commit/98ad756))
|
||||
|
||||
|
||||
|
||||
# [4.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.3.0...v4.4.0) (2020-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix typos in comments ([#1484](https://github.com/jantimon/html-webpack-plugin/issues/1484)) ([6b0711e](https://github.com/jantimon/html-webpack-plugin/commit/6b0711e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added v5 compilation support and deleted depreciation warnings ([4ae7be8](https://github.com/jantimon/html-webpack-plugin/commit/4ae7be8)), closes [#1454](https://github.com/jantimon/html-webpack-plugin/issues/1454)
|
||||
|
||||
|
||||
|
||||
# [4.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.2...v4.3.0) (2020-04-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow to use console.log inside templates ([c3f2fdc](https://github.com/jantimon/html-webpack-plugin/commit/c3f2fdc))
|
||||
|
||||
|
||||
|
||||
## [4.2.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.1...v4.2.2) (2020-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Prevent "cannot read property info of undefined" when reading meta information from assets ([253ce30](https://github.com/jantimon/html-webpack-plugin/commit/253ce30))
|
||||
* use modern icon tag rel attribute for favicons ([c40dd85](https://github.com/jantimon/html-webpack-plugin/commit/c40dd85))
|
||||
|
||||
|
||||
|
||||
## [4.2.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.0...v4.2.1) (2020-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't add dependencies twice to the webpack 5 watcher api ([ceafe14](https://github.com/jantimon/html-webpack-plugin/commit/ceafe143650749a5f53a14411dc1b762e252ec44))
|
||||
* prevent scripts marked as hotModuleReplacement from being added to the html file ([119252a](https://github.com/jantimon/html-webpack-plugin/commit/119252a381bf43dea37c1be64f90c10bebc21302))
|
||||
|
||||
|
||||
|
||||
# [4.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.1.0...v4.2.0) (2020-04-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add template content ([#1401](https://github.com/jantimon/html-webpack-plugin/issues/1401)) ([4740bf7](https://github.com/jantimon/html-webpack-plugin/commit/4740bf7))
|
||||
|
||||
|
||||
|
||||
# [4.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.4...v4.1.0) (2020-04-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add webpack 5 support ([39c38a4](https://github.com/jantimon/html-webpack-plugin/commit/39c38a4))
|
||||
* Allow webpack 5 as peer dependency ([9c571e2](https://github.com/jantimon/html-webpack-plugin/commit/9c571e2))
|
||||
|
||||
|
||||
|
||||
## [4.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.3...v4.0.4) (2020-04-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix querystring encoding ([#1386](https://github.com/jantimon/html-webpack-plugin/issues/1386)) ([4f48a39](https://github.com/jantimon/html-webpack-plugin/commit/4f48a39e5738a5d431be2bec39c1b1f0de800d57)), closes [#1355](https://github.com/jantimon/html-webpack-plugin/issues/1355)
|
||||
|
||||
|
||||
|
||||
## [4.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.2...v4.0.3) (2020-03-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add webpack, tapable and html-minifier-terser as dependencies because of types.d.ts ([238da81](https://github.com/jantimon/html-webpack-plugin/commit/238da8123950f87267954fd448f3e6b0fb1ead17))
|
||||
|
||||
|
||||
|
||||
## [4.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.1...v4.0.2) (2020-03-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't remove trailing slashes from self closing tags by default ([2281e4b](https://github.com/jantimon/html-webpack-plugin/commit/2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e))
|
||||
|
||||
|
||||
|
||||
## [4.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.0...v4.0.1) (2020-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update typedefs to match with html-minifier-terser ([2698c7e](https://github.com/jantimon/html-webpack-plugin/commit/2698c7e45a7f12113a07b256dc400ec89666130d))
|
||||
|
||||
|
||||
|
||||
# [4.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.0) (2020-03-23)
|
||||
|
||||
The summary can be found in the [**release blog post**](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d).
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add dependencies from the child compilation to the main compilation ([27c3e72](https://github.com/jantimon/html-webpack-plugin/commit/27c3e727b073701bfc739859d8325435d27cbf35))
|
||||
* Add typing for assets(Close jantimon[#1243](https://github.com/jantimon/html-webpack-plugin/issues/1243)) ([9fef060](https://github.com/jantimon/html-webpack-plugin/commit/9fef0603eb532b3e6a1e8871b4568e62f9bba1a3))
|
||||
* allow `contenthash` along with `templatehash` ([049d4d3](https://github.com/jantimon/html-webpack-plugin/commit/049d4d3436092b8beff3f5745e77b20f1c168c4c)), closes [#1033](https://github.com/jantimon/html-webpack-plugin/issues/1033)
|
||||
* Catch and ignore pretty-error errors ([2056139](https://github.com/jantimon/html-webpack-plugin/commit/2056139a9533ff9487506531491c0e5a94003607)), closes [#921](https://github.com/jantimon/html-webpack-plugin/issues/921)
|
||||
* Drop @types/webpack dependency ([d4eb1c7](https://github.com/jantimon/html-webpack-plugin/commit/d4eb1c749316af3964126606fe6c70a233c30fef))
|
||||
* Ignore foreign child compilers ([1422664](https://github.com/jantimon/html-webpack-plugin/commit/14226649aa1bbaf7b174bcacafdbe47d8ba6c851))
|
||||
* Improve perfomance for appcache files ([b94e043](https://github.com/jantimon/html-webpack-plugin/commit/b94e0434f5dbb06ee2179e91ebaa2ce7801937e0))
|
||||
* load script files before style files files in defer script loading mode ([97f9fb9](https://github.com/jantimon/html-webpack-plugin/commit/97f9fb9a68e4d3c3c9453296c352e831f7546937))
|
||||
* Prevent chunks from beeing added multiple times ([d65b37d](https://github.com/jantimon/html-webpack-plugin/commit/d65b37d2c588047e0d81a38f4645fcdb3ead0b9e))
|
||||
* Prevent lodash from being inlined to work around a babel-loader incompatibility ([7f21910](https://github.com/jantimon/html-webpack-plugin/commit/7f21910707a2b53a9a5da3ac9e4b01e36147402f)), closes [#1223](https://github.com/jantimon/html-webpack-plugin/issues/1223)
|
||||
* Remove compilation.getStats() call for performance reasons ([7005a55](https://github.com/jantimon/html-webpack-plugin/commit/7005a557529bee948c5ef0a1b8b44a1a41a28417))
|
||||
* remove useless links for options ([#1153](https://github.com/jantimon/html-webpack-plugin/issues/1153)) ([267e0e0](https://github.com/jantimon/html-webpack-plugin/commit/267e0e0eac155569c822c34f120490bdf3f56d43))
|
||||
* Update references to html-minifier ([24bf1b5](https://github.com/jantimon/html-webpack-plugin/commit/24bf1b5e2a0d087b30d057d1780d8f495aa01e26)), closes [#1311](https://github.com/jantimon/html-webpack-plugin/issues/1311)
|
||||
* **typings.d.ts:** added apply method type to HtmlWwbpackPlugin class definitoin ([8b7255f](https://github.com/jantimon/html-webpack-plugin/commit/8b7255f555423dd1bfa51a3c28700e4bd116f97b)), closes [jantimon#1244](https://github.com/jantimon/issues/1244)
|
||||
* rename `contenthash` to `templatehash` ([4c11c5d](https://github.com/jantimon/html-webpack-plugin/commit/4c11c5dfde9d87d71dce9cf51864648f8e42b912))
|
||||
* Repair typings ([#1166](https://github.com/jantimon/html-webpack-plugin/issues/1166)) ([f4cb241](https://github.com/jantimon/html-webpack-plugin/commit/f4cb241157a9a1fed4721b1abc1f390b09595494))
|
||||
* small type. minifcation instead of minification ([#1154](https://github.com/jantimon/html-webpack-plugin/issues/1154)) ([56037a6](https://github.com/jantimon/html-webpack-plugin/commit/56037a6b2ae4a7606b54f5af213b6a2b8145f95e))
|
||||
* Use src/index.ejs by default if present ([#1167](https://github.com/jantimon/html-webpack-plugin/issues/1167)) ([c27e5e4](https://github.com/jantimon/html-webpack-plugin/commit/c27e5e46a334d9c1e177a521ea7c9a5ba3c6d980))
|
||||
* **chunksorter:** Don't sort chunks by default ([22fb03f](https://github.com/jantimon/html-webpack-plugin/commit/22fb03fb17fdb37d5ce6de00af154b5575a02d3a))
|
||||
* **loader:** switch to loaderUtils.getOptions ([a0a0f0d](https://github.com/jantimon/html-webpack-plugin/commit/a0a0f0dc755fbc3249aa2e1d1c6a4dd307ab8e8a))
|
||||
* **README:** adds a link to template option documentation ([f40aeae](https://github.com/jantimon/html-webpack-plugin/commit/f40aeae312af73c6c5263cd99e81069f41d3b699))
|
||||
* **tests:** Upgrade webpack-recompilation-simulator ([dfe1d10](https://github.com/jantimon/html-webpack-plugin/commit/dfe1d10c4511b0da4354cacf79ca0d5ac7baf862))
|
||||
* Update lodash to 4.17.10 ([cc3bf49](https://github.com/jantimon/html-webpack-plugin/commit/cc3bf4909605879993c22e3048ee520dbdc8fa49))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* Change the structure of the internal assets object ([37db086](https://github.com/jantimon/html-webpack-plugin/commit/37db0868efdbf334a1b60003fe5bd376cfd8ae01))
|
||||
* Changed hook names and arguments - the hook order is 'beforeAssetTagGeneration', 'alterAssetTags', 'alterAssetTagGroups', 'afterTemplateExecution', 'beforeEmit', 'afterEmit' ([14b4456](https://github.com/jantimon/html-webpack-plugin/commit/14b4456ba67a5b85421b558bbd5f1d59c7b410b3))
|
||||
* Use Webpack 4 APIs ([47efdea](https://github.com/jantimon/html-webpack-plugin/commit/47efdeaf17806f7d4e26aefacc748a92077f904a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `.toString` implementation to htmlTags to allow easier rendering ([34d8aa5](https://github.com/jantimon/html-webpack-plugin/commit/34d8aa572c7acc59c26f3b5d15bf489a07aa4c24))
|
||||
* Add default viewport meta tag for default template ([302e39e](https://github.com/jantimon/html-webpack-plugin/commit/302e39e30013b5828bb6c9e7036db951f70d0cf5)), closes [#897](https://github.com/jantimon/html-webpack-plugin/issues/897) [#978](https://github.com/jantimon/html-webpack-plugin/issues/978)
|
||||
* Add defer script loading ([de315eb](https://github.com/jantimon/html-webpack-plugin/commit/de315eb98497f3e5f517d59dbbe120b48c9b8db9))
|
||||
* Add support for relative publicPath ([dbbdd81](https://github.com/jantimon/html-webpack-plugin/commit/dbbdd81de570dd181ea0905a6445fdeb5a784912))
|
||||
* Add support for <base> tag ([#1160](https://github.com/jantimon/html-webpack-plugin/issues/1160)) ([c5d4b86](https://github.com/jantimon/html-webpack-plugin/commit/c5d4b869c196c59cdd6a9c30db58f1f8be07a820))
|
||||
* Add support for minifying inline ES6 inside html templates ([c66766c](https://github.com/jantimon/html-webpack-plugin/commit/c66766cdae3593091dee413b9c585359c24ef068)), closes [#1262](https://github.com/jantimon/html-webpack-plugin/issues/1262)
|
||||
* Add support for the [contenthash] placeholder inside htm file names ([ae8233a](https://github.com/jantimon/html-webpack-plugin/commit/ae8233a04d4105b6e970feaa2c5e11c0b48fd4b7))
|
||||
* Add typings to package.json ([a524e8f](https://github.com/jantimon/html-webpack-plugin/commit/a524e8f24e905d5e51fedd50d33a41328a9b87eb)), closes [#1132](https://github.com/jantimon/html-webpack-plugin/issues/1132)
|
||||
* Allow to return async template parameters ([99f9362](https://github.com/jantimon/html-webpack-plugin/commit/99f9362703055baf0029b8852cb5339b6218829d))
|
||||
* drop workaround for "Uncaught TypeError: __webpack_require__(...) is not a function" to be compatible with webpack 5 ([15ad0d2](https://github.com/jantimon/html-webpack-plugin/commit/15ad0d260443edfdcc953fa08c675c90c063bac7))
|
||||
* Export major version of this plugin ([6ae6f48](https://github.com/jantimon/html-webpack-plugin/commit/6ae6f48ecf92b080809d68092ee8c6825edfe5a4))
|
||||
* merge templateParameters with default template parameters ([1d66e53](https://github.com/jantimon/html-webpack-plugin/commit/1d66e5333bc2aeb8caadf96e572af756d3708d19))
|
||||
* Provide a verbose error message if html minification failed ([7df269f](https://github.com/jantimon/html-webpack-plugin/commit/7df269fd2a840d0800cb259bd559edb0b766e7ab))
|
||||
* **compiler:** Add file dependencies ([bbc07a3](https://github.com/jantimon/html-webpack-plugin/commit/bbc07a3a214e3b693e6c9e3d6404e146a0fc023a))
|
||||
* **compiler:** Use a single compiler for multiple plugin instances ([f29ae88](https://github.com/jantimon/html-webpack-plugin/commit/f29ae886d7fad50e7fbb78ac7ff7d5bd9bc47f49))
|
||||
* **compiler:** Use timestamps to verify cache validity ([0ebcd17](https://github.com/jantimon/html-webpack-plugin/commit/0ebcd1776132262b799f2814659f4d90c3f3c1b3))
|
||||
* Remove selfClosingTag ([5d3d8e4](https://github.com/jantimon/html-webpack-plugin/commit/5d3d8e4b73b7b97dba8bdf5fe1ecf50598040b54))
|
||||
* Remove type="text/javascript" from injected script tags ([b46bf67](https://github.com/jantimon/html-webpack-plugin/commit/b46bf67ae4492a12b60c42c7d26831e480522b49))
|
||||
* Replace jade with pug in examples ([d7ec407](https://github.com/jantimon/html-webpack-plugin/commit/d7ec4078c85b3ed9c2ff84e10fe75392f26a6130))
|
||||
* Switch from jasmine to jest ([ae1f435](https://github.com/jantimon/html-webpack-plugin/commit/ae1f43527945c8ae953c2ba549631f2d090e003a))
|
||||
* **hooks:** Add a helper for easier hook access ([b6dec4b](https://github.com/jantimon/html-webpack-plugin/commit/b6dec4bf1072509282756e8d83ef6ee447485f3a))
|
||||
* **hooks:** Provide static getHook method for access to all html-webpack-plugin hooks ([#995](https://github.com/jantimon/html-webpack-plugin/issues/995)) ([82b34a1](https://github.com/jantimon/html-webpack-plugin/commit/82b34a1dd2e96cbcd715fafe4e97073efd30cc9f))
|
||||
* Simplify <meta> element and charset attribute ([55313be](https://github.com/jantimon/html-webpack-plugin/commit/55313bee9b82ea79157085e48bba4fa2ebfef6a4))
|
||||
* support ES6 template string in default loader ([d6b65dd](https://github.com/jantimon/html-webpack-plugin/commit/d6b65dd1531038deac1be87c2087da5955903d24)), closes [#950](https://github.com/jantimon/html-webpack-plugin/issues/950)
|
||||
* Use jsdoc for static typing ([a6b8d2d](https://github.com/jantimon/html-webpack-plugin/commit/a6b8d2dcf3b1183d50589b869162b972ad32de4d))
|
||||
* Use webpack 4 entries api to extract asset information ([342867e](https://github.com/jantimon/html-webpack-plugin/commit/342867e1edb7c2a8748b0aca396f160f0b13d42e))
|
||||
* **html-tags:** Add a helper to create html-tags ([ee6a165](https://github.com/jantimon/html-webpack-plugin/commit/ee6a165425a6b47dff341fb651848ec5727d7f7e))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **defaults:** Use src/index.ejs if no template option is set.
|
||||
* **defaults:** The default template has now a predefined viewport meta tag
|
||||
* **defaults:** The default meta utf-8 declaration was changed to <meta charset="utf-8"/>
|
||||
* **hooks:** Renamed beforeHtmlGeneration hook to beforeAssetTagGeneration
|
||||
* **hooks:** Renamed beforeHtmlProcessing hook to alterAssetTags
|
||||
* **hooks:** Renamed afterHtmlProcessing hook to beforeEmit
|
||||
* **hooks:** The html-webpack-plugin doesn't add its hooks to the compilation object anymore
|
||||
* The assets object which is used for the template parameters and inside hooks was changed. The chunks property was removed and the js and css property was converted from a string into an object `{ entryName: string, path: string}`
|
||||
* The mimetype information "text/javascript" is removed from all generated script
|
||||
tags
|
||||
* Remove selfClosingTag attribute
|
||||
* Template strings inside templates are now disabled by default
|
||||
* Dropped support for Webpack 1 - 3
|
||||
* Template variable webpack was removed
|
||||
* **chunksorter:** Chunks aren't sorted anymore by default
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
# [3.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.1.0...v3.2.0) (2018-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **loader:** Allow to add new template parameters ([f7eac19](https://github.com/jantimon/html-webpack-plugin/commit/f7eac19)), closes [#915](https://github.com/jantimon/html-webpack-plugin/issues/915)
|
||||
* **loader:** Use lodash inside the loader directly ([7b4eb7f](https://github.com/jantimon/html-webpack-plugin/commit/7b4eb7f)), closes [#786](https://github.com/jantimon/html-webpack-plugin/issues/786)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add meta tag option ([a7d37ca](https://github.com/jantimon/html-webpack-plugin/commit/a7d37ca))
|
||||
* Support node 6.9 ([74a22c4](https://github.com/jantimon/html-webpack-plugin/commit/74a22c4)), closes [#918](https://github.com/jantimon/html-webpack-plugin/issues/918)
|
||||
|
||||
|
||||
|
||||
<a name="3.1.0"></a>
|
||||
# [3.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.8...v3.1.0) (2018-03-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow to overwrite the templateParameter [#830](https://github.com/jantimon/html-webpack-plugin/issues/830) ([c5e32d3](https://github.com/jantimon/html-webpack-plugin/commit/c5e32d3))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.8"></a>
|
||||
## [3.0.8](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.7...v3.0.8) (2018-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** Fallback to 3.0.7 because of [#900](https://github.com/jantimon/html-webpack-plugin/issues/900) ([05ee29b](https://github.com/jantimon/html-webpack-plugin/commit/05ee29b))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.7"></a>
|
||||
## [3.0.7](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.6...v3.0.7) (2018-03-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** Set single entry name [#895](https://github.com/jantimon/html-webpack-plugin/issues/895) ([26dcb98](https://github.com/jantimon/html-webpack-plugin/commit/26dcb98))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.6"></a>
|
||||
## [3.0.6](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.5...v3.0.6) (2018-03-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **hooks:** Call tapable.apply directly [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([bcbb036](https://github.com/jantimon/html-webpack-plugin/commit/bcbb036))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.5"></a>
|
||||
## [3.0.5](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.5) (2018-03-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **entries:** do not ignore JS if there is also CSS ([020b714](https://github.com/jantimon/html-webpack-plugin/commit/020b714))
|
||||
* **entries:** Don't add css entries twice ([0348d6b](https://github.com/jantimon/html-webpack-plugin/commit/0348d6b))
|
||||
* **hooks:** Remove deprecated tapable calls [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([2288f20](https://github.com/jantimon/html-webpack-plugin/commit/2288f20))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.4"></a>
|
||||
## [3.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.4) (2018-03-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **entries:** Don't add css entries twice ([e890f23](https://github.com/jantimon/html-webpack-plugin/commit/e890f23))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.3"></a>
|
||||
## [3.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.3) (2018-03-01)
|
||||
|
||||
|
||||
### Refactor
|
||||
|
||||
* **performance:** Reduce the amount of chunk information gathered based on #825 ([06c59a7](https://github.com/jantimon/html-webpack-plugin/commit/06c59a7))
|
||||
|
||||
|
||||
<a name="3.0.2"></a>
|
||||
## [3.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.1...v3.0.2) (2018-03-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **query-loader:** In case no query is provided, return an empty object. This fixes #727 ([7587754](https://github.com/jantimon/html-webpack-plugin/commit/7587754))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.1"></a>
|
||||
## [3.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.0...v3.0.1) (2018-03-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** Remove the extract-text-webpack-plugin peer dependency ([57411a9](https://github.com/jantimon/html-webpack-plugin/commit/57411a9))
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
## [3.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v2.30.1...v3.0.0) (2018-28-02)
|
||||
|
||||
### Features
|
||||
|
||||
* Add support for the new [webpack tapable](https://github.com/webpack/tapable) to be compatible with webpack 4.x
|
||||
* Remove bluebird dependency
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Similar to webpack 4.x the support for node versions older than 6 are no longer supported
|
||||
|
||||
<a name="2.30.1"></a>
|
||||
## 2.30.1
|
||||
|
||||
* Revert part the performance optimization ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723)) because of [#753](https://github.com/jantimon/html-webpack-plugin/issues/753).
|
||||
|
||||
<a name="2.30.0"></a>
|
||||
## 2.30.0
|
||||
|
||||
* Add manual sort
|
||||
* Performance improvements ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723))
|
||||
|
||||
<a name="2.29.0"></a>
|
||||
## 2.29.0
|
||||
|
||||
* Add support for Webpack 3
|
||||
|
||||
<a name="2.28.0"></a>
|
||||
## 2.28.0
|
||||
|
||||
* Backport 3.x void tag for plugin authors
|
||||
|
||||
<a name="2.27.1"></a>
|
||||
## 2.27.1
|
||||
|
||||
* Revert 2.25.0 loader resolving
|
||||
|
||||
<a name="2.27.0"></a>
|
||||
## 2.27.0
|
||||
|
||||
* Fix a chunksorter webpack 2 issue ([#569](https://github.com/jantimon/html-webpack-plugin/pull/569))
|
||||
* Fix template path resolving ([#542](https://github.com/jantimon/html-webpack-plugin/pull/542))
|
||||
|
||||
<a name="2.26.0"></a>
|
||||
## 2.26.0
|
||||
|
||||
* Allow plugins to add attributes without values to the `<script>` and `<link>` tags
|
||||
|
||||
<a name="2.25.0"></a>
|
||||
## 2.25.0
|
||||
|
||||
* Clearer loader output
|
||||
* Add basic support for webpack 2
|
||||
|
||||
<a name="2.24.1"></a>
|
||||
## 2.24.1
|
||||
|
||||
* Hide event deprecated warning of 'applyPluginsAsyncWaterfall' for html-webpack-plugin-after-emit and improve the warning message.
|
||||
|
||||
<a name="2.24.0"></a>
|
||||
## 2.24.0
|
||||
|
||||
* Update dependencies
|
||||
* Add deprecate warning for plugins not returning a result
|
||||
* Add [path] for favicons
|
||||
|
||||
<a name="2.23.0"></a>
|
||||
## 2.23.0
|
||||
|
||||
* Update dependencies
|
||||
* Stop automated tests for webpack 2 beta because of [#401](https://github.com/jantimon/html-webpack-plugin/issues/401)
|
||||
|
||||
<a name="2.22.0"></a>
|
||||
## 2.22.0
|
||||
|
||||
* Update dependencies
|
||||
|
||||
<a name="2.21.1"></a>
|
||||
## 2.21.1
|
||||
|
||||
* Better error handling ([#354](https://github.com/jantimon/html-webpack-plugin/pull/354))
|
||||
|
||||
<a name="2.21.0"></a>
|
||||
## 2.21.0
|
||||
|
||||
* Add `html-webpack-plugin-alter-asset-tags` event to allow plugins to adjust the script/link tags
|
||||
|
||||
<a name="2.20.0"></a>
|
||||
## 2.20.0
|
||||
|
||||
* Exclude chunks works now even if combined with dependency sort
|
||||
|
||||
<a name="2.19.0"></a>
|
||||
## 2.19.0
|
||||
|
||||
* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation
|
||||
|
||||
<a name="2.18.0"></a>
|
||||
## 2.18.0
|
||||
|
||||
* Updated all dependencies
|
||||
|
||||
<a name="2.17.0"></a>
|
||||
## 2.17.0
|
||||
|
||||
* Add `type` attribute to `script` element to prevent issues in Safari 9.1.1
|
||||
|
||||
<a name="2.16.2"></a>
|
||||
## 2.16.2
|
||||
|
||||
* Fix bug introduced by 2.16.2. Fixes [#315](https://github.com/jantimon/html-webpack-plugin/issues/315)
|
||||
|
||||
<a name="2.16.1"></a>
|
||||
## 2.16.1
|
||||
|
||||
* Fix hot module replacement for webpack 2.x
|
||||
|
||||
<a name="2.16.0"></a>
|
||||
## 2.16.0
|
||||
|
||||
* Add support for dynamic filenames like index[hash].html
|
||||
|
||||
<a name="2.15.0"></a>
|
||||
## 2.15.0
|
||||
|
||||
* Add full unit test coverage for the webpack 2 beta version
|
||||
* For webpack 2 the default sort will be 'dependency' instead of 'id'
|
||||
* Upgrade dependencies
|
||||
|
||||
<a name="2.14.0"></a>
|
||||
## 2.14.0
|
||||
|
||||
* Export publicPath to the template
|
||||
* Add example for inlining css and js
|
||||
|
||||
<a name="2.13.0"></a>
|
||||
## 2.13.0
|
||||
|
||||
* Add support for absolute output file names
|
||||
* Add support for relative file names outside the output path
|
||||
|
||||
<a name="2.12.0"></a>
|
||||
## 2.12.0
|
||||
|
||||
* Basic Webpack 2.x support #225
|
||||
|
||||
<a name="2.11.0"></a>
|
||||
## 2.11.0
|
||||
|
||||
* Add `xhtml` option which is turned of by default. When activated it will inject self closed `<link href=".." />` tags instead of unclosed `<link href="..">` tags. ([#255](https://github.com/ampedandwired/html-webpack-plugin/pull/255))
|
||||
* Add support for webpack placeholders inside the public path e.g. `'/dist/[hash]/'`. ([#249](https://github.com/ampedandwired/html-webpack-plugin/pull/249))
|
||||
|
||||
<a name="2.10.0"></a>
|
||||
## 2.10.0
|
||||
|
||||
* Add `hash` field to the chunk object
|
||||
* Add `compilation` field to the templateParam object ([#237](https://github.com/ampedandwired/html-webpack-plugin/issues/237))
|
||||
* Add `html-webpack-plugin-before-html-generation` event
|
||||
* Improve error messages
|
||||
|
||||
<a name="2.9.0"></a>
|
||||
## 2.9.0
|
||||
|
||||
* Fix favicon path ([#185](https://github.com/ampedandwired/html-webpack-plugin/issues/185), [#208](https://github.com/ampedandwired/html-webpack-plugin/issues/208), [#215](https://github.com/ampedandwired/html-webpack-plugin/pull/215))
|
||||
|
||||
<a name="2.8.2"></a>
|
||||
## 2.8.2
|
||||
|
||||
* Support relative URLs on Windows ([#205](https://github.com/ampedandwired/html-webpack-plugin/issues/205))
|
||||
|
||||
<a name="2.8.1"></a>
|
||||
## 2.8.1
|
||||
|
||||
* Caching improvements ([#204](https://github.com/ampedandwired/html-webpack-plugin/issues/204))
|
||||
|
||||
<a name="2.8.0"></a>
|
||||
## 2.8.0
|
||||
|
||||
* Add `dependency` mode for `chunksSortMode` to sort chunks based on their dependencies with each other
|
||||
|
||||
<a name="2.7.2"></a>
|
||||
## 2.7.2
|
||||
|
||||
* Add support for require in js templates
|
||||
|
||||
<a name="2.7.1"></a>
|
||||
## 2.7.1
|
||||
|
||||
* Refactoring
|
||||
* Fix relative windows path
|
||||
|
||||
<a name="2.6.5"></a>
|
||||
## 2.6.5
|
||||
|
||||
* Minor refactoring
|
||||
|
||||
<a name="2.6.4"></a>
|
||||
## 2.6.4
|
||||
|
||||
* Fix for `"Uncaught TypeError: __webpack_require__(...) is not a function"`
|
||||
* Fix incomplete cache modules causing "HtmlWebpackPlugin Error: No source available"
|
||||
* Fix some issues on Windows
|
||||
|
||||
<a name="2.6.3"></a>
|
||||
## 2.6.3
|
||||
|
||||
* Prevent parsing the base template with the html-loader
|
||||
|
||||
<a name="2.6.2"></a>
|
||||
## 2.6.2
|
||||
|
||||
* Fix `lodash` resolve error ([#172](https://github.com/ampedandwired/html-webpack-plugin/issues/172))
|
||||
|
||||
<a name="2.6.1"></a>
|
||||
## 2.6.1
|
||||
|
||||
* Fix missing module ([#164](https://github.com/ampedandwired/html-webpack-plugin/issues/164))
|
||||
|
||||
<a name="2.6.0"></a>
|
||||
## 2.6.0
|
||||
|
||||
* Move compiler to its own file
|
||||
* Improve error messages
|
||||
* Fix global HTML_WEBPACK_PLUGIN variable
|
||||
|
||||
<a name="2.5.0"></a>
|
||||
## 2.5.0
|
||||
|
||||
* Support `lodash` template's HTML _"escape"_ delimiter (`<%- %>`)
|
||||
* Fix bluebird warning ([#130](https://github.com/ampedandwired/html-webpack-plugin/issues/130))
|
||||
* Fix an issue where incomplete cache modules were used
|
||||
|
||||
<a name="2.4.0"></a>
|
||||
## 2.4.0
|
||||
|
||||
* Don't recompile if the assets didn't change
|
||||
|
||||
<a name="2.3.0"></a>
|
||||
## 2.3.0
|
||||
|
||||
* Add events `html-webpack-plugin-before-html-processing`, `html-webpack-plugin-after-html-processing`, `html-webpack-plugin-after-emit` to allow other plugins to alter the html this plugin executes
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
## 2.2.0
|
||||
|
||||
* Inject css and js even if the html file is incomplete ([#135](https://github.com/ampedandwired/html-webpack-plugin/issues/135))
|
||||
* Update dependencies
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
## 2.1.0
|
||||
|
||||
* Synchronize with the stable `@1` version
|
||||
|
||||
<a name="2.0.4"></a>
|
||||
## 2.0.4
|
||||
|
||||
* Fix `minify` option
|
||||
* Fix missing hash interpolation in publicPath
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## 2.0.3
|
||||
|
||||
* Add support for webpack.BannerPlugin
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## 2.0.2
|
||||
|
||||
* Add support for loaders in templates ([#41](https://github.com/ampedandwired/html-webpack-plugin/pull/41))
|
||||
* Remove `templateContent` option from configuration
|
||||
* Better error messages
|
||||
* Update dependencies
|
||||
|
||||
|
||||
<a name="1.7.0"></a>
|
||||
## 1.7.0
|
||||
|
||||
* Add `chunksSortMode` option to configuration to control how chunks should be sorted before they are included to the html
|
||||
* Don't insert async chunks into html ([#95](https://github.com/ampedandwired/html-webpack-plugin/issues/95))
|
||||
* Update dependencies
|
||||
|
||||
<a name="1.6.2"></a>
|
||||
## 1.6.2
|
||||
|
||||
* Fix paths on Windows
|
||||
* Fix missing hash interpolation in publicPath
|
||||
* Allow only `false` or `object` in `minify` configuration option
|
||||
|
||||
<a name="1.6.1"></a>
|
||||
## 1.6.1
|
||||
|
||||
* Add `size` field to the chunk object
|
||||
* Fix stylesheet `<link>`s being discarded when used with `"inject: 'head'"`
|
||||
* Update dependencies
|
||||
|
||||
<a name="1.6.0"></a>
|
||||
## 1.6.0
|
||||
|
||||
* Support placing templates in subfolders
|
||||
* Don't include chunks with undefined name ([#60](https://github.com/ampedandwired/html-webpack-plugin/pull/60))
|
||||
* Don't include async chunks
|
||||
|
||||
<a name="1.5.2"></a>
|
||||
## 1.5.2
|
||||
|
||||
* Update dependencies (lodash)
|
||||
|
||||
<a name="1.5.1"></a>
|
||||
## 1.5.1
|
||||
|
||||
* Fix error when manifest is specified ([#56](https://github.com/ampedandwired/html-webpack-plugin/issues/56))
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
## 1.5.0
|
||||
|
||||
* Allow to inject javascript files into the head of the html page
|
||||
* Fix error reporting
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
## 1.4.0
|
||||
|
||||
* Add `favicon.ico` option
|
||||
* Add html minifcation
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
## 1.2.0
|
||||
|
||||
* Set charset using HTML5 meta attribute
|
||||
* Reload upon change when using webpack watch mode
|
||||
* Generate manifest attribute when using
|
||||
[appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)
|
||||
* Optionally add webpack hash as a query string to resources included in the HTML
|
||||
(`hash: true`) for cache busting
|
||||
* CSS files generated using webpack (for example, by using the
|
||||
[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))
|
||||
are now automatically included into the generated HTML
|
||||
* More detailed information about the files generated by webpack is now available
|
||||
to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more
|
||||
details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.
|
||||
* The `templateContent` option can now be a function that returns the template string to use
|
||||
* Expose webpack configuration to templates (`o.webpackConfig`)
|
||||
* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).
|
20
web/node_modules/html-webpack-plugin/LICENSE
generated
vendored
Normal file
20
web/node_modules/html-webpack-plugin/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
660
web/node_modules/html-webpack-plugin/README.md
generated
vendored
Normal file
660
web/node_modules/html-webpack-plugin/README.md
generated
vendored
Normal file
|
@ -0,0 +1,660 @@
|
|||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||

|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
<div align="center">
|
||||
<img width="200" height="200" src="https://worldvectorlogo.com/logos/html5.svg">
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200"
|
||||
src="https://webpack.js.org/assets/icon-square-big.svg">
|
||||
</a>
|
||||
<div>
|
||||
<img width="100" height="100" title="Webpack Plugin" src="http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg">
|
||||
</div>
|
||||
<h1>HTML Webpack Plugin</h1>
|
||||
<p>Plugin that simplifies creation of HTML files to serve your bundles</p>
|
||||
</div>
|
||||
|
||||
<h2 align="center">Install</h2>
|
||||
|
||||
```bash
|
||||
npm i --save-dev html-webpack-plugin
|
||||
```
|
||||
|
||||
```bash
|
||||
yarn add --dev html-webpack-plugin
|
||||
```
|
||||
|
||||
|
||||
This is a [webpack](http://webpack.js.org/) plugin that simplifies creation of HTML files to serve your `webpack` bundles. This is especially useful for `webpack` bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply
|
||||
your own template using `lodash` templates or use your own loader.
|
||||
|
||||
<h2 align="center">Sponsors</h2>
|
||||
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/0/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/1/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/2/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/3/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/4/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/5/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/6/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/7/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/8/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/sponsor/9/website" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/sponsor/9/avatar.svg"></a>
|
||||
|
||||
Thanks for supporting the ongoing improvements to the html-webpack-plugin!
|
||||
|
||||
<h2 align="center">Zero Config</h2>
|
||||
|
||||
The `html-webpack-plugin` works without configuration.
|
||||
It's a great addition to the [⚙️ webpack-config-plugins](https://github.com/namics/webpack-config-plugins/blob/master/README.md#zero-config-webpack-dev-server-example).
|
||||
|
||||
<h2 align="center">Plugins</h2>
|
||||
|
||||
The `html-webpack-plugin` provides [hooks](https://github.com/jantimon/html-webpack-plugin#events) to extend it to your needs. There are already some really powerful plugins which can be integrated with zero configuration
|
||||
|
||||
* [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity) for enhanced asset security
|
||||
* [appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin) for iOS and Android offline usage
|
||||
* [favicons-webpack-plugin](https://github.com/jantimon/favicons-webpack-plugin) which generates favicons and icons for iOS, Android and desktop browsers
|
||||
* [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin) can be used to always write to disk the html file, useful when webpack-dev-server / HMR are being used
|
||||
* [html-webpack-inline-source-plugin](https://github.com/DustinJackson/html-webpack-inline-source-plugin) to inline your assets in the resulting HTML file
|
||||
* [html-webpack-inline-svg-plugin](https://github.com/thegc/html-webpack-inline-svg-plugin) to inline SVGs in the resulting HTML file.
|
||||
* [html-webpack-exclude-assets-plugin](https://github.com/jamesjieye/html-webpack-exclude-assets-plugin) for excluding assets using regular expressions
|
||||
* [html-webpack-include-assets-plugin](https://github.com/jharris4/html-webpack-include-assets-plugin) for including lists of js or css file paths (such as those copied by the copy-webpack-plugin).
|
||||
* [script-ext-html-webpack-plugin](https://github.com/numical/script-ext-html-webpack-plugin) to add `async`, `defer` or `module` attributes to your `<script>` elements, or even inline them
|
||||
* [style-ext-html-webpack-plugin](https://github.com/numical/style-ext-html-webpack-plugin) to convert your `<link>`s to external stylesheets into `<style>` elements containing internal CSS
|
||||
* [html-webpack-injector](https://github.com/thearchitgarg/html-webpack-injector) to inject chunks in `head` or `body` (different locations ) of same html document.
|
||||
* [resource-hints-webpack-plugin](https://github.com/jantimon/resource-hints-webpack-plugin) to add resource hints for faster initial page loads using `<link rel='preload'>` and `<link rel='prefetch'>`
|
||||
* [preload-webpack-plugin](https://github.com/GoogleChrome/preload-webpack-plugin) for automatically wiring up asynchronous (and other types) of JavaScript chunks using `<link rel='preload'>` helping with lazy-loading
|
||||
* [link-media-html-webpack-plugin](https://github.com/yaycmyk/link-media-html-webpack-plugin) allows for injected stylesheet `<link />` tags to have their media attribute set automatically; useful for providing specific desktop/mobile/print etc. stylesheets that the browser will conditionally download
|
||||
* [inline-chunk-manifest-html-webpack-plugin](https://github.com/jouni-kantola/inline-chunk-manifest-html-webpack-plugin) for inlining webpack's chunk manifest. Default extracts manifest and inlines in `<head>`
|
||||
* [html-webpack-inline-style-plugin](https://github.com/djaax/html-webpack-inline-style-plugin) for inlining styles to HTML elements using [juice](https://github.com/Automattic/juice). Useful for email generation automatisation.
|
||||
* [html-webpack-exclude-empty-assets-plugin](https://github.com/KnisterPeter/html-webpack-exclude-empty-assets-plugin) removes empty assets from being added to the html. This fixes some problems with extract-text-plugin with webpack 4.
|
||||
* [webpack-concat-plugin](https://github.com/hxlniada/webpack-concat-plugin) for concat and uglify files that needn't to be webpack bundles(for legacy files) and inject to html-webpack-plugin.
|
||||
* [html-webpack-link-type-plugin](https://github.com/steadyapp/html-webpack-link-type-plugin) adds a configurable mimetype to resources injected as links (such as adding type="text/css" to external stylesheets) for compatibility with "strict mode".
|
||||
* [csp-html-webpack-plugin](https://github.com/slackhq/csp-html-webpack-plugin) to add [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) meta tags to the HTML output
|
||||
* [webpack-nomodule-plugin](https://github.com/swimmadude66/webpack-nomodule-plugin) allows you to add a `nomodule` attribute to specific injected scripts, which prevents the scripts from being loaded by newer browsers. Good for limiting loads of polyfills.
|
||||
* [html-webpack-skip-assets-plugin](https://github.com/swimmadude66/html-webpack-skip-assets-plugin) Skip adding certain output files to the html file. Built as a drop-in replacement for [html-webpack-exclude-assets-plugin](https://www.npmjs.com/package/html-webpack-exclude-assets-plugin) and works with newer [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) versions
|
||||
|
||||
|
||||
<h2 align="center">Usage</h2>
|
||||
|
||||
The plugin will generate an HTML5 file for you that includes all your `webpack`
|
||||
bundles in the body using `script` tags. Just add the plugin to your `webpack`
|
||||
config as follows:
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
entry: 'index.js',
|
||||
output: {
|
||||
path: __dirname + '/dist',
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin()
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This will generate a file `dist/index.html` containing the following
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Webpack App</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="index_bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
If you have multiple `webpack` entry points, they will all be included with `script` tags in the generated HTML.
|
||||
|
||||
If you have any CSS assets in webpack's output (for example, CSS extracted with the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin))
|
||||
then these will be included with `<link>` tags in the HTML head.
|
||||
|
||||
If you have plugins that make use of it, `html-webpack-plugin` should be ordered first before any of the integrated plugins.
|
||||
|
||||
<h2 align="center">Options</h2>
|
||||
|
||||
You can pass a hash of configuration options to `html-webpack-plugin`.
|
||||
Allowed values are as follows
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|**`title`**|`{String}`|`Webpack App`|The title to use for the generated HTML document|
|
||||
|**`filename`**|`{String}`|`'index.html'`|The file to write the HTML to. Defaults to `index.html`. You can specify a subdirectory here too (eg: `assets/admin.html`)|
|
||||
|**`template`**|`{String}`|``|`webpack` relative or absolute path to the template. By default it will use `src/index.ejs` if it exists. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details|
|
||||
|**`templateContent`**|`{string\|Function\|false}`|false| Can be used instead of `template` to provide an inline template - please read the [Writing Your Own Templates](https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates) section |
|
||||
|**`templateParameters`**|`{Boolean\|Object\|Function}`| `false`| Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters) |
|
||||
|**`inject`**|`{Boolean\|String}`|`true`|`true \|\| 'head' \|\| 'body' \|\| false` Inject all assets into the given `template` or `templateContent`. When passing `true` or `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position)|
|
||||
|**`publicPath`**|`{String|'auto'}`|`'auto'`|The publicPath used for script and link tags|
|
||||
|**`scriptLoading`**|`{'blocking'\|'defer'}`|`'blocking'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. |
|
||||
|**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML|
|
||||
|**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`|
|
||||
|**`base`**|`{Object\|String\|false}`|`false`|Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: "https://example.com/path/page.html`|
|
||||
|**`minify`**|`{Boolean\|Object}`|`true` if `mode` is `'production'`, otherwise `false`|Controls if and in what ways the output should be minified. See [minification](#minification) below for more details.|
|
||||
|**`hash`**|`{Boolean}`|`false`|If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files. This is useful for cache busting|
|
||||
|**`cache`**|`{Boolean}`|`true`|Emit the file only if it was changed|
|
||||
|**`showErrors`**|`{Boolean}`|`true`|Errors details will be written into the HTML page|
|
||||
|**`chunks`**|`{?}`|`?`|Allows you to add only some chunks (e.g only the unit-test chunk)|
|
||||
|**`chunksSortMode`**|`{String\|Function}`|`auto`|Allows to control how chunks should be sorted before they are included to the HTML. Allowed values are `'none' \| 'auto' \| 'manual' \| {Function}`|
|
||||
|**`excludeChunks`**|`{Array.<string>}`|``|Allows you to skip some chunks (e.g don't add the unit-test chunk)|
|
||||
|**`xhtml`**|`{Boolean}`|`false`|If `true` render the `link` tags as self-closing (XHTML compliant)|
|
||||
|
||||
Here's an example webpack config illustrating how to use these options
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
{
|
||||
entry: 'index.js',
|
||||
output: {
|
||||
path: __dirname + '/dist',
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'My App',
|
||||
filename: 'assets/admin.html'
|
||||
})
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Generating Multiple HTML Files
|
||||
|
||||
To generate more than one HTML file, declare the plugin more than
|
||||
once in your plugins array
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
{
|
||||
entry: 'index.js',
|
||||
output: {
|
||||
path: __dirname + '/dist',
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin(), // Generates default index.html
|
||||
new HtmlWebpackPlugin({ // Also generate a test.html
|
||||
filename: 'test.html',
|
||||
template: 'src/assets/test.html'
|
||||
})
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Writing Your Own Templates
|
||||
|
||||
If the default generated HTML doesn't meet your needs you can supply
|
||||
your own template. The easiest way is to use the `template` option and pass a custom HTML file.
|
||||
The html-webpack-plugin will automatically inject all necessary CSS, JS, manifest
|
||||
and favicon files into the markup.
|
||||
|
||||
Details of other template loaders are [documented here](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md).
|
||||
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'Custom template',
|
||||
// Load a custom template (lodash by default)
|
||||
template: 'index.html'
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
**index.html**
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
If you already have a template loader, you can use it to parse the template.
|
||||
Please note that this will also happen if you specify the html-loader and use `.html` file as template.
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.hbs$/, loader: "handlebars-loader" }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'Custom template using Handlebars',
|
||||
template: 'index.hbs'
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
You can use the `lodash` syntax out of the box. If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/jaketrent/html-webpack-template/blob/86f285d5c790a6c15263f5cc50fd666d51f974fd/index.html) of the [html-webpack-template project](https://github.com/jaketrent/html-webpack-template) as a starting point for writing your own.
|
||||
|
||||
The following variables are available in the template by default (you can extend them using the `templateParameters` option):
|
||||
|
||||
- `htmlWebpackPlugin`: data specific to this plugin
|
||||
|
||||
- `htmlWebpackPlugin.options`: the options hash that was passed to
|
||||
the plugin. In addition to the options actually used by this plugin,
|
||||
you can use this hash to pass arbitrary data through to your template.
|
||||
|
||||
- `htmlWebpackPlugin.tags`: the prepared `headTags` and `bodyTags` Array to render the `<base>`, `<meta>`, `<script>` and `<link>` tags.
|
||||
Can be used directly in templates and literals. For example:
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<%= htmlWebpackPlugin.tags.headTags %>
|
||||
</head>
|
||||
<body>
|
||||
<%= htmlWebpackPlugin.tags.bodyTags %>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
- `htmlWebpackPlugin.files`: direct access to the files used during the compilation.
|
||||
|
||||
```typescript
|
||||
publicPath: string;
|
||||
js: string[];
|
||||
css: string[];
|
||||
manifest?: string;
|
||||
favicon?: string;
|
||||
```
|
||||
|
||||
|
||||
- `webpackConfig`: the webpack configuration that was used for this compilation. This
|
||||
can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`).
|
||||
|
||||
- `compilation`: the webpack [compilation object](https://webpack.js.org/api/compilation-object/).
|
||||
This can be used, for example, to get the contents of processed assets and inline them
|
||||
directly in the page, through `compilation.assets[...].source()`
|
||||
(see [the inline template example](examples/inline/template.pug)).
|
||||
|
||||
|
||||
The template can also be directly inlined directly into the options object.
|
||||
⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
new HtmlWebpackPlugin({
|
||||
templateContent: `
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hello World</h1>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
})
|
||||
```
|
||||
|
||||
The `templateContent` can also access all `templateParameters` values.
|
||||
⚠️ **`templateContent` does not allow to use webpack loaders for your template and will not watch for template file changes**
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
new HtmlWebpackPlugin({
|
||||
inject: false,
|
||||
templateContent: ({htmlWebpackPlugin}) => `
|
||||
<html>
|
||||
<head>
|
||||
${htmlWebpackPlugin.tags.headTags}
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World</h1>
|
||||
${htmlWebpackPlugin.tags.bodyTags}
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
})
|
||||
```
|
||||
|
||||
### Filtering Chunks
|
||||
|
||||
To include only certain chunks you can limit the chunks being used
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['app']
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
It is also possible to exclude certain chunks by setting the `excludeChunks` option
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
excludeChunks: [ 'dev-helper' ]
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
### Minification
|
||||
|
||||
If the `minify` option is set to `true` (the default when webpack's `mode` is `'production'`),
|
||||
the generated HTML will be minified using [html-minifier-terser](https://github.com/DanielRuf/html-minifier-terser)
|
||||
and the following options:
|
||||
|
||||
```js
|
||||
{
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
removeScriptTypeAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
useShortDoctype: true
|
||||
}
|
||||
```
|
||||
|
||||
To use custom [html-minifier options](https://github.com/DanielRuf/html-minifier-terser#options-quick-reference)
|
||||
pass an object to `minify` instead. This object will not be merged with the defaults above.
|
||||
|
||||
To disable minification during production mode set the `minify` option to `false`.
|
||||
|
||||
### Meta Tags
|
||||
|
||||
If the `meta` option is set the html-webpack-plugin will inject meta tags.
|
||||
For the default template the html-webpack-plugin will already provide a default for the `viewport` meta tag.
|
||||
|
||||
Please take a look at this well maintained list of almost all [possible meta tags](https://github.com/joshbuchea/HEAD#meta).
|
||||
|
||||
#### name/content meta tags
|
||||
|
||||
Most meta tags are configured by setting a `name` and a `content` attribute.
|
||||
To add those use a key/value pair:
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
'meta': {
|
||||
'viewport': 'width=device-width, initial-scale=1, shrink-to-fit=no',
|
||||
// Will generate: <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
'theme-color': '#4285f4'
|
||||
// Will generate: <meta name="theme-color" content="#4285f4">
|
||||
}
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
#### Simulate http response headers
|
||||
|
||||
The **http-equiv** attribute is essentially used to simulate a HTTP response header.
|
||||
This format is supported using an object notation which allows you to add any attribute:
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
'meta': {
|
||||
'Content-Security-Policy': { 'http-equiv': 'Content-Security-Policy', 'content': 'default-src https:' },
|
||||
// Will generate: <meta http-equiv="Content-Security-Policy" content="default-src https:">
|
||||
// Which equals to the following http header: `Content-Security-Policy: default-src https:`
|
||||
'set-cookie': { 'http-equiv': 'set-cookie', content: 'name=value; expires=date; path=url' },
|
||||
// Will generate: <meta http-equiv="set-cookie" content="value; expires=date; path=url">
|
||||
// Which equals to the following http header: `set-cookie: value; expires=date; path=url`
|
||||
}
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
### Base Tag
|
||||
|
||||
When the `base` option is used,
|
||||
html-webpack-plugin will inject a [base tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base).
|
||||
By default, a base tag will not be injected.
|
||||
|
||||
The following two are identical and will both insert `<base href="http://example.com/some/page.html">`:
|
||||
|
||||
```js
|
||||
new HtmlWebpackPlugin({
|
||||
'base': 'http://example.com/some/page.html'
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
new HtmlWebpackPlugin({
|
||||
'base': { 'href': 'http://example.com/some/page.html' }
|
||||
})
|
||||
```
|
||||
|
||||
The `target` can be specified with the corresponding key:
|
||||
|
||||
```js
|
||||
new HtmlWebpackPlugin({
|
||||
'base': {
|
||||
'href': 'http://example.com/some/page.html',
|
||||
'target': '_blank'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
which will inject the element `<base href="http://example.com/some/page.html" target="_blank">`.
|
||||
|
||||
### Long Term Caching
|
||||
|
||||
For long term caching add `contenthash/templatehash` to the filename.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.[contenthash].html'
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
`contenthash/templatehash` is the hash of the content of the output file.
|
||||
|
||||
Optionally, You can configure like `[<hashType>:contenthash:<digestType>:<length>]`
|
||||
|
||||
* `hashType` - one of `sha1`, `md5`, `sha256`, `sha512` or any other node.js supported hash type
|
||||
* `digestType` - one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* `maxlength` - maximum length of the generated hash in chars
|
||||
|
||||
**Defaults:** `[md5:contenthash:hex:9999]`
|
||||
|
||||
### Events
|
||||
|
||||
To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the HTML this plugin executes
|
||||
[tapable](https://github.com/webpack/tapable/tree/master) hooks.
|
||||
|
||||
The [lib/hooks.js](https://github.com/jantimon/html-webpack-plugin/blob/master/lib/hooks.js) contains all information
|
||||
about which values are passed.
|
||||
|
||||
[](https://github.com/jantimon/html-webpack-plugin/blob/master/flow.puml)
|
||||
|
||||
#### `beforeAssetTagGeneration` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
assets: {
|
||||
publicPath: string,
|
||||
js: Array<{string}>,
|
||||
css: Array<{string}>,
|
||||
favicon?: string | undefined,
|
||||
manifest?: string | undefined
|
||||
},
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>
|
||||
```
|
||||
|
||||
#### `alterAssetTags` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
assetTags: {
|
||||
scripts: Array<HtmlTagObject>,
|
||||
styles: Array<HtmlTagObject>,
|
||||
meta: Array<HtmlTagObject>,
|
||||
},
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>
|
||||
```
|
||||
|
||||
#### `alterAssetTagGroups` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>
|
||||
```
|
||||
|
||||
#### `afterTemplateExecution` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
html: string,
|
||||
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin,
|
||||
}>
|
||||
```
|
||||
|
||||
#### `beforeEmit` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
html: string,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin,
|
||||
}>
|
||||
```
|
||||
|
||||
#### `afterEmit` hook
|
||||
|
||||
```
|
||||
AsyncSeriesWaterfallHook<{
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>
|
||||
```
|
||||
|
||||
Example implementation: [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity)
|
||||
|
||||
**plugin.js**
|
||||
```js
|
||||
// If your plugin is direct dependent to the html webpack plugin:
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
// If your plugin is using html-webpack-plugin as an optional dependency
|
||||
// you can use https://github.com/tallesl/node-safe-require instead:
|
||||
const HtmlWebpackPlugin = require('safe-require')('html-webpack-plugin');
|
||||
|
||||
class MyPlugin {
|
||||
apply (compiler) {
|
||||
compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
|
||||
console.log('The compiler is starting a new compilation...')
|
||||
|
||||
// Static Plugin interface |compilation |HOOK NAME | register listener
|
||||
HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync(
|
||||
'MyPlugin', // <-- Set a meaningful name here for stacktraces
|
||||
(data, cb) => {
|
||||
// Manipulate the content
|
||||
data.html += 'The Magic Footer'
|
||||
// Tell webpack to move on
|
||||
cb(null, data)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MyPlugin
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
plugins: [
|
||||
new MyPlugin({ options: '' })
|
||||
]
|
||||
```
|
||||
|
||||
Note that the callback must be passed the HtmlWebpackPluginData in order to pass this onto any other plugins listening on the same `beforeEmit` event
|
||||
|
||||
<h2 align="center">Maintainers</h2>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://avatars3.githubusercontent.com/u/4113649?v=3&s=150">
|
||||
</br>
|
||||
<a href="https://github.com/jantimon">Jan Nicklas</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://avatars2.githubusercontent.com/u/4112409?v=3&s=150">
|
||||
</br>
|
||||
<a href="https://github.com/mastilver">Thomas Sileghem</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers!
|
||||
If you want to support the project as well [become a sponsor](https://opencollective.com/html-webpack-plugin#sponsor) or a [a backer](https://opencollective.com/html-webpack-plugin#backer).
|
||||
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/0/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/1/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/2/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/3/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/4/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/5/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/6/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/7/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/8/avatar.svg?requireActive=false"></a>
|
||||
<a href="https://opencollective.com/html-webpack-plugin/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/html-webpack-plugin/backer/9/avatar.svg?requireActive=false"></a>
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
|
||||
You're free to contribute to this project by submitting [issues](https://github.com/jantimon/html-webpack-plugin/issues) and/or [pull requests](https://github.com/jantimon/html-webpack-plugin/pulls). This project is test-driven, so keep in mind that every change and new feature should be covered by tests.
|
||||
|
||||
This project uses the [semistandard code style](https://github.com/Flet/semistandard).
|
||||
|
||||
<a href="https://github.com/jantimon/html-webpack-plugin/graphs/contributors"><img src="https://opencollective.com/html-webpack-plugin/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
|
||||
[npm-url]: https://npmjs.com/package/html-webpack-plugin
|
||||
|
||||
[node]: https://img.shields.io/node/v/html-webpack-plugin.svg
|
||||
[node-url]: https://nodejs.org
|
||||
|
||||
[deps]: https://david-dm.org/jantimon/html-webpack-plugin.svg
|
||||
[deps-url]: https://david-dm.org/jantimon/html-webpack-plugin
|
||||
|
||||
[tests]: http://img.shields.io/travis/jantimon/html-webpack-plugin.svg
|
||||
[tests-url]: https://travis-ci.org/jantimon/html-webpack-plugin
|
9
web/node_modules/html-webpack-plugin/default_index.ejs
generated
vendored
Normal file
9
web/node_modules/html-webpack-plugin/default_index.ejs
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
1088
web/node_modules/html-webpack-plugin/index.js
generated
vendored
Normal file
1088
web/node_modules/html-webpack-plugin/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
379
web/node_modules/html-webpack-plugin/lib/cached-child-compiler.js
generated
vendored
Normal file
379
web/node_modules/html-webpack-plugin/lib/cached-child-compiler.js
generated
vendored
Normal file
|
@ -0,0 +1,379 @@
|
|||
// @ts-check
|
||||
/**
|
||||
* @file
|
||||
* Helper plugin manages the cached state of the child compilation
|
||||
*
|
||||
* To optimize performance the child compilation is running asyncronously.
|
||||
* Therefore it needs to be started in the compiler.make phase and ends after
|
||||
* the compilation.afterCompile phase.
|
||||
*
|
||||
* To prevent bugs from blocked hooks there is no promise or event based api
|
||||
* for this plugin.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* ```js
|
||||
const childCompilerPlugin = new PersistentChildCompilerPlugin();
|
||||
childCompilerPlugin.addEntry('./src/index.js');
|
||||
compiler.hooks.afterCompile.tapAsync('MyPlugin', (compilation, callback) => {
|
||||
console.log(childCompilerPlugin.getCompilationResult()['./src/index.js']));
|
||||
return true;
|
||||
});
|
||||
* ```
|
||||
*/
|
||||
|
||||
// Import types
|
||||
/** @typedef {import("webpack/lib/Compiler.js")} WebpackCompiler */
|
||||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
/** @typedef {{hash: string, entry: any, content: string }} ChildCompilationResultEntry */
|
||||
/** @typedef {import("./webpack4/file-watcher-api").Snapshot} Snapshot */
|
||||
/** @typedef {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} FileDependencies */
|
||||
/** @typedef {{
|
||||
dependencies: FileDependencies,
|
||||
compiledEntries: {[entryName: string]: ChildCompilationResultEntry}
|
||||
} | {
|
||||
dependencies: FileDependencies,
|
||||
error: Error
|
||||
}} ChildCompilationResult */
|
||||
'use strict';
|
||||
|
||||
const { HtmlWebpackChildCompiler } = require('./child-compiler');
|
||||
const fileWatcherApi = require('./file-watcher-api');
|
||||
|
||||
/**
|
||||
* This plugin is a singleton for performance reasons.
|
||||
* To keep track if a plugin does already exist for the compiler they are cached
|
||||
* in this map
|
||||
* @type {WeakMap<WebpackCompiler, PersistentChildCompilerSingletonPlugin>}}
|
||||
*/
|
||||
const compilerMap = new WeakMap();
|
||||
|
||||
class CachedChildCompilation {
|
||||
/**
|
||||
* @param {WebpackCompiler} compiler
|
||||
*/
|
||||
constructor (compiler) {
|
||||
/**
|
||||
* @private
|
||||
* @type {WebpackCompiler}
|
||||
*/
|
||||
this.compiler = compiler;
|
||||
// Create a singleton instance for the compiler
|
||||
// if there is none
|
||||
if (compilerMap.has(compiler)) {
|
||||
return;
|
||||
}
|
||||
const persistentChildCompilerSingletonPlugin = new PersistentChildCompilerSingletonPlugin();
|
||||
compilerMap.set(compiler, persistentChildCompilerSingletonPlugin);
|
||||
persistentChildCompilerSingletonPlugin.apply(compiler);
|
||||
}
|
||||
|
||||
/**
|
||||
* apply is called by the webpack main compiler during the start phase
|
||||
* @param {string} entry
|
||||
*/
|
||||
addEntry (entry) {
|
||||
const persistentChildCompilerSingletonPlugin = compilerMap.get(this.compiler);
|
||||
if (!persistentChildCompilerSingletonPlugin) {
|
||||
throw new Error(
|
||||
'PersistentChildCompilerSingletonPlugin instance not found.'
|
||||
);
|
||||
}
|
||||
persistentChildCompilerSingletonPlugin.addEntry(entry);
|
||||
}
|
||||
|
||||
getCompilationResult () {
|
||||
const persistentChildCompilerSingletonPlugin = compilerMap.get(this.compiler);
|
||||
if (!persistentChildCompilerSingletonPlugin) {
|
||||
throw new Error(
|
||||
'PersistentChildCompilerSingletonPlugin instance not found.'
|
||||
);
|
||||
}
|
||||
return persistentChildCompilerSingletonPlugin.getLatestResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result for the given entry
|
||||
* @param {string} entry
|
||||
* @returns {
|
||||
| { mainCompilationHash: string, error: Error }
|
||||
| { mainCompilationHash: string, compiledEntry: ChildCompilationResultEntry }
|
||||
}
|
||||
*/
|
||||
getCompilationEntryResult (entry) {
|
||||
const latestResult = this.getCompilationResult();
|
||||
const compilationResult = latestResult.compilationResult;
|
||||
return 'error' in compilationResult ? {
|
||||
mainCompilationHash: latestResult.mainCompilationHash,
|
||||
error: compilationResult.error
|
||||
} : {
|
||||
mainCompilationHash: latestResult.mainCompilationHash,
|
||||
compiledEntry: compilationResult.compiledEntries[entry]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class PersistentChildCompilerSingletonPlugin {
|
||||
constructor () {
|
||||
/**
|
||||
* @private
|
||||
* @type {
|
||||
| {
|
||||
isCompiling: false,
|
||||
isVerifyingCache: false,
|
||||
entries: string[],
|
||||
compiledEntries: string[],
|
||||
mainCompilationHash: string,
|
||||
compilationResult: ChildCompilationResult
|
||||
}
|
||||
| Readonly<{
|
||||
isCompiling: false,
|
||||
isVerifyingCache: true,
|
||||
entries: string[],
|
||||
previousEntries: string[],
|
||||
previousResult: ChildCompilationResult
|
||||
}>
|
||||
| Readonly <{
|
||||
isVerifyingCache: false,
|
||||
isCompiling: true,
|
||||
entries: string[],
|
||||
}>
|
||||
} the internal compilation state */
|
||||
this.compilationState = {
|
||||
isCompiling: false,
|
||||
isVerifyingCache: false,
|
||||
entries: [],
|
||||
compiledEntries: [],
|
||||
mainCompilationHash: 'initial',
|
||||
compilationResult: {
|
||||
dependencies: {
|
||||
fileDependencies: [],
|
||||
contextDependencies: [],
|
||||
missingDependencies: []
|
||||
},
|
||||
compiledEntries: {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* apply is called by the webpack main compiler during the start phase
|
||||
* @param {WebpackCompiler} compiler
|
||||
*/
|
||||
apply (compiler) {
|
||||
/** @type Promise<ChildCompilationResult> */
|
||||
let childCompilationResultPromise = Promise.resolve({
|
||||
dependencies: {
|
||||
fileDependencies: [],
|
||||
contextDependencies: [],
|
||||
missingDependencies: []
|
||||
},
|
||||
compiledEntries: {}
|
||||
});
|
||||
/**
|
||||
* The main compilation hash which will only be updated
|
||||
* if the childCompiler changes
|
||||
*/
|
||||
let mainCompilationHashOfLastChildRecompile = '';
|
||||
/** @typedef{Snapshot|undefined} */
|
||||
let previousFileSystemSnapshot;
|
||||
let compilationStartTime = new Date().getTime();
|
||||
|
||||
compiler.hooks.make.tapAsync(
|
||||
'PersistentChildCompilerSingletonPlugin',
|
||||
(mainCompilation, callback) => {
|
||||
if (this.compilationState.isCompiling || this.compilationState.isVerifyingCache) {
|
||||
return callback(new Error('Child compilation has already started'));
|
||||
}
|
||||
|
||||
// Update the time to the current compile start time
|
||||
compilationStartTime = new Date().getTime();
|
||||
|
||||
// The compilation starts - adding new templates is now not possible anymore
|
||||
this.compilationState = {
|
||||
isCompiling: false,
|
||||
isVerifyingCache: true,
|
||||
previousEntries: this.compilationState.compiledEntries,
|
||||
previousResult: this.compilationState.compilationResult,
|
||||
entries: this.compilationState.entries
|
||||
};
|
||||
|
||||
// Validate cache:
|
||||
const isCacheValidPromise = this.isCacheValid(previousFileSystemSnapshot, mainCompilation);
|
||||
|
||||
let cachedResult = childCompilationResultPromise;
|
||||
childCompilationResultPromise = isCacheValidPromise.then((isCacheValid) => {
|
||||
// Reuse cache
|
||||
if (isCacheValid) {
|
||||
return cachedResult;
|
||||
}
|
||||
// Start the compilation
|
||||
const compiledEntriesPromise = this.compileEntries(
|
||||
mainCompilation,
|
||||
this.compilationState.entries
|
||||
);
|
||||
// Update snapshot as soon as we know the filedependencies
|
||||
// this might possibly cause bugs if files were changed inbetween
|
||||
// compilation start and snapshot creation
|
||||
compiledEntriesPromise.then((childCompilationResult) => {
|
||||
return fileWatcherApi.createSnapshot(childCompilationResult.dependencies, mainCompilation, compilationStartTime);
|
||||
}).then((snapshot) => {
|
||||
previousFileSystemSnapshot = snapshot;
|
||||
});
|
||||
return compiledEntriesPromise;
|
||||
});
|
||||
|
||||
// Add files to compilation which needs to be watched:
|
||||
mainCompilation.hooks.optimizeTree.tapAsync(
|
||||
'PersistentChildCompilerSingletonPlugin',
|
||||
(chunks, modules, callback) => {
|
||||
const handleCompilationDonePromise = childCompilationResultPromise.then(
|
||||
childCompilationResult => {
|
||||
this.watchFiles(
|
||||
mainCompilation,
|
||||
childCompilationResult.dependencies
|
||||
);
|
||||
});
|
||||
handleCompilationDonePromise.then(() => callback(null, chunks, modules), callback);
|
||||
}
|
||||
);
|
||||
|
||||
// Store the final compilation once the main compilation hash is known
|
||||
mainCompilation.hooks.additionalAssets.tapAsync(
|
||||
'PersistentChildCompilerSingletonPlugin',
|
||||
(callback) => {
|
||||
const didRecompilePromise = Promise.all([childCompilationResultPromise, cachedResult]).then(
|
||||
([childCompilationResult, cachedResult]) => {
|
||||
// Update if childCompilation changed
|
||||
return (cachedResult !== childCompilationResult);
|
||||
}
|
||||
);
|
||||
|
||||
const handleCompilationDonePromise = Promise.all([childCompilationResultPromise, didRecompilePromise]).then(
|
||||
([childCompilationResult, didRecompile]) => {
|
||||
// Update hash and snapshot if childCompilation changed
|
||||
if (didRecompile) {
|
||||
mainCompilationHashOfLastChildRecompile = mainCompilation.hash;
|
||||
}
|
||||
this.compilationState = {
|
||||
isCompiling: false,
|
||||
isVerifyingCache: false,
|
||||
entries: this.compilationState.entries,
|
||||
compiledEntries: this.compilationState.entries,
|
||||
compilationResult: childCompilationResult,
|
||||
mainCompilationHash: mainCompilationHashOfLastChildRecompile
|
||||
};
|
||||
});
|
||||
handleCompilationDonePromise.then(() => callback(null), callback);
|
||||
}
|
||||
);
|
||||
|
||||
// Continue compilation:
|
||||
callback(null);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new entry to the next compile run
|
||||
* @param {string} entry
|
||||
*/
|
||||
addEntry (entry) {
|
||||
if (this.compilationState.isCompiling || this.compilationState.isVerifyingCache) {
|
||||
throw new Error(
|
||||
'The child compiler has already started to compile. ' +
|
||||
"Please add entries before the main compiler 'make' phase has started or " +
|
||||
'after the compilation is done.'
|
||||
);
|
||||
}
|
||||
if (this.compilationState.entries.indexOf(entry) === -1) {
|
||||
this.compilationState.entries = [...this.compilationState.entries, entry];
|
||||
}
|
||||
}
|
||||
|
||||
getLatestResult () {
|
||||
if (this.compilationState.isCompiling || this.compilationState.isVerifyingCache) {
|
||||
throw new Error(
|
||||
'The child compiler is not done compiling. ' +
|
||||
"Please access the result after the compiler 'make' phase has started or " +
|
||||
'after the compilation is done.'
|
||||
);
|
||||
}
|
||||
return {
|
||||
mainCompilationHash: this.compilationState.mainCompilationHash,
|
||||
compilationResult: this.compilationState.compilationResult
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the cache is still valid
|
||||
* @private
|
||||
* @param {Snapshot | undefined} snapshot
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
isCacheValid (snapshot, mainCompilation) {
|
||||
if (!this.compilationState.isVerifyingCache) {
|
||||
return Promise.reject(new Error('Cache validation can only be done right before the compilation starts'));
|
||||
}
|
||||
// If there are no entries we don't need a new child compilation
|
||||
if (this.compilationState.entries.length === 0) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
// If there are new entries the cache is invalid
|
||||
if (this.compilationState.entries !== this.compilationState.previousEntries) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
// Mark the cache as invalid if there is no snapshot
|
||||
if (!snapshot) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
return fileWatcherApi.isSnapShotValid(snapshot, mainCompilation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start to compile all templates
|
||||
*
|
||||
* @private
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @param {string[]} entries
|
||||
* @returns {Promise<ChildCompilationResult>}
|
||||
*/
|
||||
compileEntries (mainCompilation, entries) {
|
||||
const compiler = new HtmlWebpackChildCompiler(entries);
|
||||
return compiler.compileTemplates(mainCompilation).then((result) => {
|
||||
return {
|
||||
// The compiled sources to render the content
|
||||
compiledEntries: result,
|
||||
// The file dependencies to find out if a
|
||||
// recompilation is required
|
||||
dependencies: compiler.fileDependencies,
|
||||
// The main compilation hash can be used to find out
|
||||
// if this compilation was done during the current compilation
|
||||
mainCompilationHash: mainCompilation.hash
|
||||
};
|
||||
}, error => ({
|
||||
// The compiled sources to render the content
|
||||
error,
|
||||
// The file dependencies to find out if a
|
||||
// recompilation is required
|
||||
dependencies: compiler.fileDependencies,
|
||||
// The main compilation hash can be used to find out
|
||||
// if this compilation was done during the current compilation
|
||||
mainCompilationHash: mainCompilation.hash
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @param {FileDependencies} files
|
||||
*/
|
||||
watchFiles (mainCompilation, files) {
|
||||
fileWatcherApi.watchFiles(mainCompilation, files);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
CachedChildCompilation
|
||||
};
|
198
web/node_modules/html-webpack-plugin/lib/child-compiler.js
generated
vendored
Normal file
198
web/node_modules/html-webpack-plugin/lib/child-compiler.js
generated
vendored
Normal file
|
@ -0,0 +1,198 @@
|
|||
// @ts-check
|
||||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
/** @typedef {import("webpack/lib/Compiler.js")} WebpackCompiler */
|
||||
/** @typedef {import("webpack/lib/Chunk.js")} WebpackChunk */
|
||||
'use strict';
|
||||
/**
|
||||
* @file
|
||||
* This file uses webpack to compile a template with a child compiler.
|
||||
*
|
||||
* [TEMPLATE] -> [JAVASCRIPT]
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
const NodeTemplatePlugin = require('webpack/lib/node/NodeTemplatePlugin');
|
||||
const NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin');
|
||||
const LoaderTargetPlugin = require('webpack/lib/LoaderTargetPlugin');
|
||||
const LibraryTemplatePlugin = require('webpack/lib/LibraryTemplatePlugin');
|
||||
const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
|
||||
|
||||
/**
|
||||
* The HtmlWebpackChildCompiler is a helper to allow reusing one childCompiler
|
||||
* for multiple HtmlWebpackPlugin instances to improve the compilation performance.
|
||||
*/
|
||||
class HtmlWebpackChildCompiler {
|
||||
/**
|
||||
*
|
||||
* @param {string[]} templates
|
||||
*/
|
||||
constructor (templates) {
|
||||
/**
|
||||
* @type {string[]} templateIds
|
||||
* The template array will allow us to keep track which input generated which output
|
||||
*/
|
||||
this.templates = templates;
|
||||
/**
|
||||
* @type {Promise<{[templatePath: string]: { content: string, hash: string, entry: WebpackChunk }}>}
|
||||
*/
|
||||
this.compilationPromise; // eslint-disable-line
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.compilationStartedTimestamp; // eslint-disable-line
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.compilationEndedTimestamp; // eslint-disable-line
|
||||
/**
|
||||
* All file dependencies of the child compiler
|
||||
* @type {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}}
|
||||
*/
|
||||
this.fileDependencies = { fileDependencies: [], contextDependencies: [], missingDependencies: [] };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the childCompiler is currently compiling
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCompiling () {
|
||||
return !this.didCompile() && this.compilationStartedTimestamp !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the childCompiler is done compiling
|
||||
*/
|
||||
didCompile () {
|
||||
return this.compilationEndedTimestamp !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will start the template compilation
|
||||
* once it is started no more templates can be added
|
||||
*
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @returns {Promise<{[templatePath: string]: { content: string, hash: string, entry: WebpackChunk }}>}
|
||||
*/
|
||||
compileTemplates (mainCompilation) {
|
||||
// To prevent multiple compilations for the same template
|
||||
// the compilation is cached in a promise.
|
||||
// If it already exists return
|
||||
if (this.compilationPromise) {
|
||||
return this.compilationPromise;
|
||||
}
|
||||
|
||||
// The entry file is just an empty helper as the dynamic template
|
||||
// require is added in "loader.js"
|
||||
const outputOptions = {
|
||||
filename: '__child-[name]',
|
||||
publicPath: mainCompilation.outputOptions.publicPath
|
||||
};
|
||||
const compilerName = 'HtmlWebpackCompiler';
|
||||
// Create an additional child compiler which takes the template
|
||||
// and turns it into an Node.JS html factory.
|
||||
// This allows us to use loaders during the compilation
|
||||
const childCompiler = mainCompilation.createChildCompiler(compilerName, outputOptions);
|
||||
// The file path context which webpack uses to resolve all relative files to
|
||||
childCompiler.context = mainCompilation.compiler.context;
|
||||
// Compile the template to nodejs javascript
|
||||
new NodeTemplatePlugin(outputOptions).apply(childCompiler);
|
||||
new NodeTargetPlugin().apply(childCompiler);
|
||||
new LibraryTemplatePlugin('HTML_WEBPACK_PLUGIN_RESULT', 'var').apply(childCompiler);
|
||||
new LoaderTargetPlugin('node').apply(childCompiler);
|
||||
|
||||
// Add all templates
|
||||
this.templates.forEach((template, index) => {
|
||||
new SingleEntryPlugin(childCompiler.context, template, `HtmlWebpackPlugin_${index}`).apply(childCompiler);
|
||||
});
|
||||
|
||||
this.compilationStartedTimestamp = new Date().getTime();
|
||||
this.compilationPromise = new Promise((resolve, reject) => {
|
||||
childCompiler.runAsChild((err, entries, childCompilation) => {
|
||||
// Extract templates
|
||||
const compiledTemplates = entries
|
||||
? extractHelperFilesFromCompilation(mainCompilation, childCompilation, outputOptions.filename, entries)
|
||||
: [];
|
||||
// Extract file dependencies
|
||||
if (entries) {
|
||||
this.fileDependencies = { fileDependencies: Array.from(childCompilation.fileDependencies), contextDependencies: Array.from(childCompilation.contextDependencies), missingDependencies: Array.from(childCompilation.missingDependencies) };
|
||||
}
|
||||
// Reject the promise if the childCompilation contains error
|
||||
if (childCompilation && childCompilation.errors && childCompilation.errors.length) {
|
||||
const errorDetails = childCompilation.errors.map(error => {
|
||||
let message = error.message;
|
||||
if (error.error) {
|
||||
message += ':\n' + error.error;
|
||||
}
|
||||
if (error.stack) {
|
||||
message += '\n' + error.stack;
|
||||
}
|
||||
return message;
|
||||
}).join('\n');
|
||||
reject(new Error('Child compilation failed:\n' + errorDetails));
|
||||
return;
|
||||
}
|
||||
// Reject if the error object contains errors
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {{[templatePath: string]: { content: string, hash: string, entry: WebpackChunk }}}
|
||||
*/
|
||||
const result = {};
|
||||
compiledTemplates.forEach((templateSource, entryIndex) => {
|
||||
// The compiledTemplates are generated from the entries added in
|
||||
// the addTemplate function.
|
||||
// Therefore the array index of this.templates should be the as entryIndex.
|
||||
result[this.templates[entryIndex]] = {
|
||||
content: templateSource,
|
||||
hash: childCompilation.hash,
|
||||
entry: entries[entryIndex]
|
||||
};
|
||||
});
|
||||
this.compilationEndedTimestamp = new Date().getTime();
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
return this.compilationPromise;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The webpack child compilation will create files as a side effect.
|
||||
* This function will extract them and clean them up so they won't be written to disk.
|
||||
*
|
||||
* Returns the source code of the compiled templates as string
|
||||
*
|
||||
* @returns Array<string>
|
||||
*/
|
||||
function extractHelperFilesFromCompilation (mainCompilation, childCompilation, filename, childEntryChunks) {
|
||||
const webpackMajorVersion = Number(require('webpack/package.json').version.split('.')[0]);
|
||||
|
||||
const helperAssetNames = childEntryChunks.map((entryChunk, index) => {
|
||||
const entryConfig = {
|
||||
hash: childCompilation.hash,
|
||||
chunk: entryChunk,
|
||||
name: `HtmlWebpackPlugin_${index}`
|
||||
};
|
||||
|
||||
return webpackMajorVersion === 4
|
||||
? mainCompilation.mainTemplate.getAssetPath(filename, entryConfig)
|
||||
: mainCompilation.getAssetPath(filename, entryConfig);
|
||||
});
|
||||
|
||||
helperAssetNames.forEach((helperFileName) => {
|
||||
delete mainCompilation.assets[helperFileName];
|
||||
});
|
||||
|
||||
const helperContents = helperAssetNames.map((helperFileName) => {
|
||||
return childCompilation.assets[helperFileName].source();
|
||||
});
|
||||
|
||||
return helperContents;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
HtmlWebpackChildCompiler
|
||||
};
|
40
web/node_modules/html-webpack-plugin/lib/chunksorter.js
generated
vendored
Normal file
40
web/node_modules/html-webpack-plugin/lib/chunksorter.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
// @ts-check
|
||||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @type {{[sortmode: string] : (entryPointNames: Array<string>, compilation, htmlWebpackPluginOptions) => Array<string> }}
|
||||
* This file contains different sort methods for the entry chunks names
|
||||
*/
|
||||
module.exports = {};
|
||||
|
||||
/**
|
||||
* Performs identity mapping (no-sort).
|
||||
* @param {Array} chunks the chunks to sort
|
||||
* @return {Array} The sorted chunks
|
||||
*/
|
||||
module.exports.none = chunks => chunks;
|
||||
|
||||
/**
|
||||
* Sort manually by the chunks
|
||||
* @param {string[]} entryPointNames the chunks to sort
|
||||
* @param {WebpackCompilation} compilation the webpack compilation
|
||||
* @param htmlWebpackPluginOptions the plugin options
|
||||
* @return {string[]} The sorted chunks
|
||||
*/
|
||||
module.exports.manual = (entryPointNames, compilation, htmlWebpackPluginOptions) => {
|
||||
const chunks = htmlWebpackPluginOptions.chunks;
|
||||
if (!Array.isArray(chunks)) {
|
||||
return entryPointNames;
|
||||
}
|
||||
// Remove none existing entries from
|
||||
// htmlWebpackPluginOptions.chunks
|
||||
return chunks.filter((entryPointName) => {
|
||||
return compilation.entrypoints.has(entryPointName);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines the default sorter.
|
||||
*/
|
||||
module.exports.auto = module.exports.none;
|
31
web/node_modules/html-webpack-plugin/lib/errors.js
generated
vendored
Normal file
31
web/node_modules/html-webpack-plugin/lib/errors.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
// @ts-nocheck
|
||||
'use strict';
|
||||
const PrettyError = require('pretty-error');
|
||||
const prettyError = new PrettyError();
|
||||
prettyError.withoutColors();
|
||||
prettyError.skipPackage('html-plugin-evaluation');
|
||||
prettyError.skipNodeFiles();
|
||||
prettyError.skip(function (traceLine) {
|
||||
return traceLine.path === 'html-plugin-evaluation';
|
||||
});
|
||||
|
||||
module.exports = function (err, context) {
|
||||
return {
|
||||
toHtml: function () {
|
||||
return 'Html Webpack Plugin:\n<pre>\n' + this.toString() + '</pre>';
|
||||
},
|
||||
toJsonHtml: function () {
|
||||
return JSON.stringify(this.toHtml());
|
||||
},
|
||||
toString: function () {
|
||||
try {
|
||||
return prettyError.render(err).replace(/webpack:\/\/\/\./g, context);
|
||||
} catch (e) {
|
||||
// This can sometimes fail. We don't know why, but returning the
|
||||
// original error is better than returning the error thrown by
|
||||
// pretty-error.
|
||||
return err;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
14
web/node_modules/html-webpack-plugin/lib/file-watcher-api.js
generated
vendored
Normal file
14
web/node_modules/html-webpack-plugin/lib/file-watcher-api.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
// @ts-check
|
||||
/**
|
||||
* To use the available webpack core api
|
||||
* we have to use different child compilers
|
||||
* depending on the used webpack version
|
||||
*/
|
||||
const webpackMajorVersion = Number(require('webpack/package.json').version.split('.')[0]);
|
||||
|
||||
// Typescript hack to test only the webpack 4 code
|
||||
/** @type {import('./webpack4/file-watcher-api')} */
|
||||
module.exports = webpackMajorVersion === 4
|
||||
? require('./webpack4/file-watcher-api.js')
|
||||
// Hack to ignore './webpack5/file-watcher-api.js' from typescript:
|
||||
: require('./webpack' + 5 + '/file-watcher-api.js');
|
106
web/node_modules/html-webpack-plugin/lib/hooks.js
generated
vendored
Normal file
106
web/node_modules/html-webpack-plugin/lib/hooks.js
generated
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
// @ts-check
|
||||
/** @typedef {import("../typings").Hooks} HtmlWebpackPluginHooks */
|
||||
'use strict';
|
||||
/**
|
||||
* This file provides access to all public htmlWebpackPlugin hooks
|
||||
*/
|
||||
|
||||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
/** @typedef {import("../index.js")} HtmlWebpackPlugin */
|
||||
|
||||
const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
|
||||
|
||||
// The following is the API definition for all available hooks
|
||||
// For the TypeScript definition, see the Hooks type in typings.d.ts
|
||||
/**
|
||||
beforeAssetTagGeneration:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
assets: {
|
||||
publicPath: string,
|
||||
js: Array<string>,
|
||||
css: Array<string>,
|
||||
favicon?: string | undefined,
|
||||
manifest?: string | undefined
|
||||
},
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>,
|
||||
alterAssetTags:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
assetTags: {
|
||||
scripts: Array<HtmlTagObject>,
|
||||
styles: Array<HtmlTagObject>,
|
||||
meta: Array<HtmlTagObject>,
|
||||
},
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>,
|
||||
alterAssetTagGroups:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>,
|
||||
afterTemplateExecution:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
html: string,
|
||||
headTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
bodyTags: Array<HtmlTagObject | HtmlTagObject>,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin,
|
||||
}>,
|
||||
beforeEmit:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
html: string,
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin,
|
||||
}>,
|
||||
afterEmit:
|
||||
AsyncSeriesWaterfallHook<{
|
||||
outputName: string,
|
||||
plugin: HtmlWebpackPlugin
|
||||
}>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {WeakMap<WebpackCompilation, HtmlWebpackPluginHooks>}}
|
||||
*/
|
||||
const htmlWebpackPluginHooksMap = new WeakMap();
|
||||
|
||||
/**
|
||||
* Returns all public hooks of the html webpack plugin for the given compilation
|
||||
*
|
||||
* @param {WebpackCompilation} compilation
|
||||
* @returns {HtmlWebpackPluginHooks}
|
||||
*/
|
||||
function getHtmlWebpackPluginHooks (compilation) {
|
||||
let hooks = htmlWebpackPluginHooksMap.get(compilation);
|
||||
// Setup the hooks only once
|
||||
if (hooks === undefined) {
|
||||
hooks = createHtmlWebpackPluginHooks();
|
||||
htmlWebpackPluginHooksMap.set(compilation, hooks);
|
||||
}
|
||||
return hooks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hooks to the webpack compilation object to allow foreign plugins to
|
||||
* extend the HtmlWebpackPlugin
|
||||
*
|
||||
* @returns {HtmlWebpackPluginHooks}
|
||||
*/
|
||||
function createHtmlWebpackPluginHooks () {
|
||||
return {
|
||||
beforeAssetTagGeneration: new AsyncSeriesWaterfallHook(['pluginArgs']),
|
||||
alterAssetTags: new AsyncSeriesWaterfallHook(['pluginArgs']),
|
||||
alterAssetTagGroups: new AsyncSeriesWaterfallHook(['pluginArgs']),
|
||||
afterTemplateExecution: new AsyncSeriesWaterfallHook(['pluginArgs']),
|
||||
beforeEmit: new AsyncSeriesWaterfallHook(['pluginArgs']),
|
||||
afterEmit: new AsyncSeriesWaterfallHook(['pluginArgs'])
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getHtmlWebpackPluginHooks
|
||||
};
|
95
web/node_modules/html-webpack-plugin/lib/html-tags.js
generated
vendored
Normal file
95
web/node_modules/html-webpack-plugin/lib/html-tags.js
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
// @ts-check
|
||||
/** @typedef {import("../typings").HtmlTagObject} HtmlTagObject */
|
||||
/**
|
||||
* @file
|
||||
* This file provides to helper to create html as a object representation as
|
||||
* those objects are easier to modify than pure string representations
|
||||
*
|
||||
* Usage:
|
||||
* ```
|
||||
* const element = createHtmlTagObject('h1', {class: 'demo'}, 'Hello World');
|
||||
* const html = htmlTagObjectToString(element);
|
||||
* console.log(html) // -> <h1 class="demo">Hello World</h1>
|
||||
* ```
|
||||
*/
|
||||
|
||||
/**
|
||||
* All html tag elements which must not contain innerHTML
|
||||
* @see https://www.w3.org/TR/html5/syntax.html#void-elements
|
||||
*/
|
||||
const voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||
|
||||
/**
|
||||
* Turn a tag definition into a html string
|
||||
* @param {HtmlTagObject} tagDefinition
|
||||
* A tag element according to the htmlWebpackPlugin object notation
|
||||
*
|
||||
* @param xhtml {boolean}
|
||||
* Wether the generated html should add closing slashes to be xhtml compliant
|
||||
*/
|
||||
function htmlTagObjectToString (tagDefinition, xhtml) {
|
||||
const attributes = Object.keys(tagDefinition.attributes || {})
|
||||
.filter(function (attributeName) {
|
||||
return tagDefinition.attributes[attributeName] !== false;
|
||||
})
|
||||
.map(function (attributeName) {
|
||||
if (tagDefinition.attributes[attributeName] === true) {
|
||||
return xhtml ? attributeName + '="' + attributeName + '"' : attributeName;
|
||||
}
|
||||
return attributeName + '="' + tagDefinition.attributes[attributeName] + '"';
|
||||
});
|
||||
return '<' + [tagDefinition.tagName].concat(attributes).join(' ') + (tagDefinition.voidTag && xhtml ? '/' : '') + '>' +
|
||||
(tagDefinition.innerHTML || '') +
|
||||
(tagDefinition.voidTag ? '' : '</' + tagDefinition.tagName + '>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Static helper to create a tag object to be get injected into the dom
|
||||
*
|
||||
* @param {string} tagName
|
||||
* the name of the tag e.g. 'div'
|
||||
*
|
||||
* @param {{[attributeName: string]: string|boolean}} [attributes]
|
||||
* tag attributes e.g. `{ 'class': 'example', disabled: true }`
|
||||
*
|
||||
* @param {string} [innerHTML]
|
||||
*
|
||||
* @returns {HtmlTagObject}
|
||||
*/
|
||||
function createHtmlTagObject (tagName, attributes, innerHTML) {
|
||||
return {
|
||||
tagName: tagName,
|
||||
voidTag: voidTags.indexOf(tagName) !== -1,
|
||||
attributes: attributes || {},
|
||||
innerHTML: innerHTML
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The `HtmlTagArray Array with a custom `.toString()` method.
|
||||
*
|
||||
* This allows the following:
|
||||
* ```
|
||||
* const tags = HtmlTagArray.from([tag1, tag2]);
|
||||
* const scriptTags = tags.filter((tag) => tag.tagName === 'script');
|
||||
* const html = scriptTags.toString();
|
||||
* ```
|
||||
*
|
||||
* Or inside a string literal:
|
||||
* ```
|
||||
* const tags = HtmlTagArray.from([tag1, tag2]);
|
||||
* const html = `<html><body>${tags.filter((tag) => tag.tagName === 'script')}</body></html>`;
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
class HtmlTagArray extends Array {
|
||||
toString () {
|
||||
return this.join('');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
HtmlTagArray: HtmlTagArray,
|
||||
createHtmlTagObject: createHtmlTagObject,
|
||||
htmlTagObjectToString: htmlTagObjectToString
|
||||
};
|
34
web/node_modules/html-webpack-plugin/lib/loader.js
generated
vendored
Normal file
34
web/node_modules/html-webpack-plugin/lib/loader.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* This loader renders the template with underscore if no other loader was found */
|
||||
// @ts-nocheck
|
||||
'use strict';
|
||||
const _ = require('lodash');
|
||||
const loaderUtils = require('loader-utils');
|
||||
|
||||
module.exports = function (source) {
|
||||
// Get templating options
|
||||
const options = this.query !== '' ? loaderUtils.getOptions(this) : {};
|
||||
const force = options.force || false;
|
||||
|
||||
const allLoadersButThisOne = this.loaders.filter(function (loader) {
|
||||
return loader.normal !== module.exports;
|
||||
});
|
||||
// This loader shouldn't kick in if there is any other loader (unless it's explicitly enforced)
|
||||
if (allLoadersButThisOne.length > 0 && !force) {
|
||||
return source;
|
||||
}
|
||||
// Skip .js files (unless it's explicitly enforced)
|
||||
if (/\.js$/.test(this.resourcePath) && !force) {
|
||||
return source;
|
||||
}
|
||||
|
||||
// The following part renders the template with lodash as a minimalistic loader
|
||||
//
|
||||
const template = _.template(source, _.defaults(options, { interpolate: /<%=([\s\S]+?)%>/g, variable: 'data' }));
|
||||
// Use __non_webpack_require__ to enforce using the native nodejs require
|
||||
// during template execution
|
||||
return 'var _ = __non_webpack_require__(' + JSON.stringify(require.resolve('lodash')) + ');' +
|
||||
'module.exports = function (templateParams) { with(templateParams) {' +
|
||||
// Execute the lodash template
|
||||
'return (' + template.source + ')();' +
|
||||
'}}';
|
||||
};
|
64
web/node_modules/html-webpack-plugin/lib/webpack4/file-watcher-api.js
generated
vendored
Normal file
64
web/node_modules/html-webpack-plugin/lib/webpack4/file-watcher-api.js
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
/** @typedef {{timestamp: number, fileDependencies: string[]}} Snapshot */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} fileDependencies
|
||||
* @param {WebpackCompilation} compilation
|
||||
* @param {number} startTime
|
||||
*/
|
||||
function createSnapshot (fileDependencies, compilation, startTime) {
|
||||
const flatDependencies = [];
|
||||
Object.keys(fileDependencies).forEach((depencyTypes) => {
|
||||
fileDependencies[depencyTypes].forEach(fileDependency => {
|
||||
flatDependencies.push(fileDependency);
|
||||
});
|
||||
});
|
||||
return {
|
||||
fileDependencies: flatDependencies,
|
||||
timestamp: startTime
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the files inside this snapshot
|
||||
* have not been changed
|
||||
*
|
||||
* @param {Snapshot} snapshot
|
||||
* @param {WebpackCompilation} compilation
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
function isSnapShotValid (snapshot, compilation) {
|
||||
// Check if any dependent file was changed after the last compilation
|
||||
const fileTimestamps = compilation.fileTimestamps;
|
||||
const isCacheOutOfDate = snapshot.fileDependencies.some((fileDependency) => {
|
||||
const timestamp = fileTimestamps.get(fileDependency);
|
||||
// If the timestamp is not known the file is new
|
||||
// If the timestamp is larger then the file has changed
|
||||
// Otherwise the file is still the same
|
||||
return !timestamp || timestamp > snapshot.timestamp;
|
||||
});
|
||||
return Promise.resolve(!isCacheOutOfDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the files keep watched for changes
|
||||
* and will trigger a recompile
|
||||
*
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @param {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} fileDependencies
|
||||
*/
|
||||
function watchFiles (mainCompilation, fileDependencies) {
|
||||
Object.keys(fileDependencies).forEach((depencyTypes) => {
|
||||
fileDependencies[depencyTypes].forEach(fileDependency => {
|
||||
mainCompilation.compilationDependencies.add(fileDependency);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSnapshot,
|
||||
isSnapShotValid,
|
||||
watchFiles
|
||||
};
|
70
web/node_modules/html-webpack-plugin/lib/webpack5/file-watcher-api.js
generated
vendored
Normal file
70
web/node_modules/html-webpack-plugin/lib/webpack5/file-watcher-api.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
|
||||
/** @typedef {import("webpack/lib/FileSystemInfo").Snapshot} Snapshot */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} fileDependencies
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @param {number} startTime
|
||||
*/
|
||||
function createSnapshot (fileDependencies, mainCompilation, startTime) {
|
||||
return new Promise((resolve, reject) => {
|
||||
mainCompilation.fileSystemInfo.createSnapshot(
|
||||
startTime,
|
||||
fileDependencies.fileDependencies,
|
||||
fileDependencies.contextDependencies,
|
||||
fileDependencies.missingDependencies,
|
||||
null,
|
||||
(err, snapshot) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve(snapshot);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the files inside this snapshot
|
||||
* have not been changed
|
||||
*
|
||||
* @param {Snapshot} snapshot
|
||||
* @param {WebpackCompilation} compilation
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
function isSnapShotValid (snapshot, mainCompilation) {
|
||||
return new Promise((resolve, reject) => {
|
||||
mainCompilation.fileSystemInfo.checkSnapshotValid(
|
||||
snapshot,
|
||||
(err, isValid) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
resolve(isValid);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the files keep watched for changes
|
||||
* and will trigger a recompile
|
||||
*
|
||||
* @param {WebpackCompilation} mainCompilation
|
||||
* @param {{fileDependencies: string[], contextDependencies: string[], missingDependencies: string[]}} fileDependencies
|
||||
*/
|
||||
function watchFiles (mainCompilation, fileDependencies) {
|
||||
Object.keys(fileDependencies).forEach((depencyTypes) => {
|
||||
fileDependencies[depencyTypes].forEach(fileDependency => {
|
||||
mainCompilation[depencyTypes].add(fileDependency);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSnapshot,
|
||||
isSnapShotValid,
|
||||
watchFiles
|
||||
};
|
1
web/node_modules/html-webpack-plugin/node_modules/.bin/json5
generated
vendored
Symbolic link
1
web/node_modules/html-webpack-plugin/node_modules/.bin/json5
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../json5/lib/cli.js
|
274
web/node_modules/html-webpack-plugin/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
274
web/node_modules/html-webpack-plugin/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,274 @@
|
|||
### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
|
||||
|
||||
[c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
|
||||
[d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
|
||||
|
||||
This release includes a bug fix and minor change.
|
||||
|
||||
- Fix: `parse` throws on unclosed objects and arrays.
|
||||
|
||||
- New: `package.json5` has been removed until an easier way to keep it in sync
|
||||
with `package.json` is found.
|
||||
|
||||
|
||||
### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
|
||||
|
||||
[c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
|
||||
[d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major** JSON5 officially supports Node.js v4 and later. Support for Node.js
|
||||
v0.10 and v0.12 have been dropped.
|
||||
|
||||
- New: Unicode property names and Unicode escapes in property names are
|
||||
supported. ([#1])
|
||||
|
||||
- New: `stringify` outputs trailing commas in objects and arrays when a `space`
|
||||
option is provided. ([#66])
|
||||
|
||||
- New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
|
||||
in strings in order to be compatible with JSON. However, ES5 does not allow
|
||||
these characters in strings, so JSON5 gives a warning when they are parsed and
|
||||
escapes them when they are stringified. ([#70])
|
||||
|
||||
- New: `stringify` accepts an options object as its second argument. The
|
||||
supported options are `replacer`, `space`, and a new `quote` option that
|
||||
specifies the quote character used in strings. ([#71])
|
||||
|
||||
- New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
|
||||
`--validate` options. See `json5 --help` for more information. ([#72], [#84],
|
||||
and [#108])
|
||||
|
||||
- New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
|
||||
`\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
|
||||
and all other characters in the Space Separator Unicode category are allowed.
|
||||
|
||||
- New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
|
||||
`\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
|
||||
escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
|
||||
values and string property names.
|
||||
|
||||
- New: `stringify` outputs strings with single quotes by default but
|
||||
intelligently uses double quotes if there are more single quotes than double
|
||||
quotes inside the string. (i.e. `stringify('Stay here.')` outputs
|
||||
`'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
|
||||
|
||||
- New: When a character is not allowed in a string, `stringify` outputs a
|
||||
character escape like `\t` when available, a hexadecimal escape like `\x0F`
|
||||
when the Unicode code point is less than 256, or a Unicode character escape
|
||||
like `\u01FF`, in that order.
|
||||
|
||||
- New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
|
||||
stringifies its return value instead of the object. `toJSON5` overrides
|
||||
`toJSON` if they both exist.
|
||||
|
||||
- New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
|
||||
or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
|
||||
which still exists for backward compatibility but is deprecated and will give
|
||||
a warning.
|
||||
|
||||
- New: To use JSON5 in browsers, use the file at `dist/index.js` or
|
||||
`https://unpkg.com/json5@^1.0.0`.
|
||||
|
||||
- Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
|
||||
|
||||
- Fix: `isWord` no longer becomes a property of `JSON5` after calling
|
||||
`stringify`. ([#68] and [#89])
|
||||
|
||||
- Fix: `stringify` no longer throws when an object does not have a `prototype`.
|
||||
([#154])
|
||||
|
||||
- Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
|
||||
`toJSON5(key)` follows this pattern.
|
||||
|
||||
- Fix: `stringify` accepts `Number` and `String` objects as its `space`
|
||||
argument.
|
||||
|
||||
- Fix: In addition to a function, `stringify` also accepts an array of keys to
|
||||
include in the output as its `replacer` argument. Numbers, `Number` objects,
|
||||
and `String` objects will be converted to a string if they are given as array
|
||||
values.
|
||||
|
||||
|
||||
### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
|
||||
|
||||
[c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
|
||||
[d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
|
||||
|
||||
This release includes a minor fix for indentations when stringifying empty
|
||||
arrays.
|
||||
|
||||
- Fix: Indents no longer appear in empty arrays when stringified. ([#134])
|
||||
|
||||
|
||||
### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
|
||||
|
||||
[c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
|
||||
[d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
|
||||
Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
|
||||
remain.
|
||||
|
||||
- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
|
||||
|
||||
- New: `parse` and the CLI provide line and column numbers when displaying error
|
||||
messages. ([#101]; awesome work by [@amb26].)
|
||||
|
||||
|
||||
### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
|
||||
|
||||
[c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
|
||||
[d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
|
||||
|
||||
Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
|
||||
changelog entry includes v0.3.0 features.
|
||||
|
||||
This is a massive release that adds `stringify` support, among other things.
|
||||
|
||||
- **Major:** `JSON5.stringify()` now exists!
|
||||
This method is analogous to the native `JSON.stringify()`;
|
||||
it just avoids quoting keys where possible.
|
||||
See the [usage documentation](./README.md#usage) for more.
|
||||
([#32]; huge thanks and props [@aeisenberg]!)
|
||||
|
||||
- New: `NaN` and `-NaN` are now allowed number literals.
|
||||
([#30]; thanks [@rowanhill].)
|
||||
|
||||
- New: Duplicate object keys are now allowed; the last value is used.
|
||||
This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
|
||||
|
||||
- Fix: Properly handle various whitespace and newline cases now.
|
||||
E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
|
||||
and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
|
||||
([#58], [#60], and [#63]; thanks [@jordanbtucker].)
|
||||
|
||||
- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
|
||||
(They were disallowed in v0.2.0; see below.)
|
||||
It turns out they *are* valid in ES5, so JSON5 supports them now too.
|
||||
([#36]; thanks [@jordanbtucker]!)
|
||||
|
||||
|
||||
### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
|
||||
|
||||
[c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
|
||||
[d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
|
||||
|
||||
This release fixes some bugs and adds some more utility features to help you
|
||||
express data more easily:
|
||||
|
||||
- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
|
||||
While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
|
||||
in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
|
||||
and Node), so JSON5 officially rejects them now, too. ([#36])
|
||||
|
||||
- New: Trailing decimal points in decimal numbers are allowed again.
|
||||
(They were disallowed in v0.1.0; see below.)
|
||||
They're allowed by ES5, and differentiating between integers and floats may
|
||||
make sense on some platforms. ([#16]; thanks [@Midar].)
|
||||
|
||||
- New: `Infinity` and `-Infinity` are now allowed number literals.
|
||||
([#30]; thanks [@pepkin88].)
|
||||
|
||||
- New: Plus signs (`+`) in front of numbers are now allowed, since it can
|
||||
be helpful in some contexts to explicitly mark numbers as positive.
|
||||
(E.g. when a property represents changes or deltas.)
|
||||
|
||||
- Fix: unescaped newlines in strings are rejected now.
|
||||
([#24]; thanks [@Midar].)
|
||||
|
||||
|
||||
### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
|
||||
|
||||
[c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
|
||||
[d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
|
||||
|
||||
This release tightens JSON5 support and adds helpful utility features:
|
||||
|
||||
- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- Fix: Reject octal numbers properly now. Previously, they were accepted but
|
||||
improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
|
||||
leading zero). These are disallowed by both JSON5 and JSON, as well as by
|
||||
ES5's strict mode. (Thanks [@MaxNanasy].)
|
||||
|
||||
- New: Support leading decimal points in decimal numbers.
|
||||
(Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject trailing decimal points in decimal numbers now. These
|
||||
are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject omitted elements in arrays now. These are disallowed by
|
||||
both JSON5 and JSON.
|
||||
|
||||
- Fix: Throw proper `SyntaxError` instances on errors now.
|
||||
|
||||
- New: Add Node.js `require()` hook. Register via `json5/lib/require`.
|
||||
|
||||
- New: Add Node.js `json5` executable to compile JSON5 files to JSON.
|
||||
|
||||
|
||||
### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
|
||||
|
||||
[c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
|
||||
[d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
|
||||
|
||||
This was the first implementation of this JSON5 parser.
|
||||
|
||||
- Support unquoted object keys, including reserved words. Unicode characters
|
||||
and escape sequences sequences aren't yet supported.
|
||||
|
||||
- Support single-quoted strings.
|
||||
|
||||
- Support multi-line strings.
|
||||
|
||||
- Support trailing commas in arrays and objects.
|
||||
|
||||
- Support comments, both inline and block.
|
||||
|
||||
|
||||
### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
|
||||
|
||||
Let's consider this to be Douglas Crockford's original [json_parse.js] — a
|
||||
parser for the regular JSON format.
|
||||
|
||||
|
||||
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
|
||||
|
||||
[@MaxNanasy]: https://github.com/MaxNanasy
|
||||
[@Midar]: https://github.com/Midar
|
||||
[@pepkin88]: https://github.com/pepkin88
|
||||
[@rowanhill]: https://github.com/rowanhill
|
||||
[@aeisenberg]: https://github.com/aeisenberg
|
||||
[@jordanbtucker]: https://github.com/jordanbtucker
|
||||
[@amb26]: https://github.com/amb26
|
||||
|
||||
[#1]: https://github.com/json5/json5/issues/1
|
||||
[#16]: https://github.com/json5/json5/issues/16
|
||||
[#24]: https://github.com/json5/json5/issues/24
|
||||
[#30]: https://github.com/json5/json5/issues/30
|
||||
[#32]: https://github.com/json5/json5/issues/32
|
||||
[#36]: https://github.com/json5/json5/issues/36
|
||||
[#57]: https://github.com/json5/json5/issues/57
|
||||
[#58]: https://github.com/json5/json5/pull/58
|
||||
[#60]: https://github.com/json5/json5/pull/60
|
||||
[#63]: https://github.com/json5/json5/pull/63
|
||||
[#66]: https://github.com/json5/json5/issues/66
|
||||
[#67]: https://github.com/json5/json5/issues/67
|
||||
[#68]: https://github.com/json5/json5/issues/68
|
||||
[#70]: https://github.com/json5/json5/issues/70
|
||||
[#71]: https://github.com/json5/json5/issues/71
|
||||
[#72]: https://github.com/json5/json5/issues/72
|
||||
[#84]: https://github.com/json5/json5/pull/84
|
||||
[#89]: https://github.com/json5/json5/pull/89
|
||||
[#97]: https://github.com/json5/json5/pull/97
|
||||
[#101]: https://github.com/json5/json5/pull/101
|
||||
[#108]: https://github.com/json5/json5/pull/108
|
||||
[#134]: https://github.com/json5/json5/pull/134
|
||||
[#154]: https://github.com/json5/json5/issues/154
|
23
web/node_modules/html-webpack-plugin/node_modules/json5/LICENSE.md
generated
vendored
Normal file
23
web/node_modules/html-webpack-plugin/node_modules/json5/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2012-2018 Aseem Kishore, and [others].
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
[others]: https://github.com/json5/json5/contributors
|
234
web/node_modules/html-webpack-plugin/node_modules/json5/README.md
generated
vendored
Normal file
234
web/node_modules/html-webpack-plugin/node_modules/json5/README.md
generated
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
# JSON5 – JSON for Humans
|
||||
|
||||
[][Build Status]
|
||||
[][Coverage
|
||||
Status]
|
||||
|
||||
The JSON5 Data Interchange Format (JSON5) is a superset of [JSON] that aims to
|
||||
alleviate some of the limitations of JSON by expanding its syntax to include
|
||||
some productions from [ECMAScript 5.1].
|
||||
|
||||
This JavaScript library is the official reference implementation for JSON5
|
||||
parsing and serialization libraries.
|
||||
|
||||
[Build Status]: https://travis-ci.org/json5/json5
|
||||
|
||||
[Coverage Status]: https://coveralls.io/github/json5/json5
|
||||
|
||||
[JSON]: https://tools.ietf.org/html/rfc7159
|
||||
|
||||
[ECMAScript 5.1]: https://www.ecma-international.org/ecma-262/5.1/
|
||||
|
||||
## Summary of Features
|
||||
The following ECMAScript 5.1 features, which are not supported in JSON, have
|
||||
been extended to JSON5.
|
||||
|
||||
### Objects
|
||||
- Object keys may be an ECMAScript 5.1 _[IdentifierName]_.
|
||||
- Objects may have a single trailing comma.
|
||||
|
||||
### Arrays
|
||||
- Arrays may have a single trailing comma.
|
||||
|
||||
### Strings
|
||||
- Strings may be single quoted.
|
||||
- Strings may span multiple lines by escaping new line characters.
|
||||
- Strings may include character escapes.
|
||||
|
||||
### Numbers
|
||||
- Numbers may be hexadecimal.
|
||||
- Numbers may have a leading or trailing decimal point.
|
||||
- Numbers may be [IEEE 754] positive infinity, negative infinity, and NaN.
|
||||
- Numbers may begin with an explicit plus sign.
|
||||
|
||||
### Comments
|
||||
- Single and multi-line comments are allowed.
|
||||
|
||||
### White Space
|
||||
- Additional white space characters are allowed.
|
||||
|
||||
[IdentifierName]: https://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
||||
|
||||
[IEEE 754]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
|
||||
|
||||
## Short Example
|
||||
```js
|
||||
{
|
||||
// comments
|
||||
unquoted: 'and you can quote me on that',
|
||||
singleQuotes: 'I can use "double quotes" here',
|
||||
lineBreaks: "Look, Mom! \
|
||||
No \\n's!",
|
||||
hexadecimal: 0xdecaf,
|
||||
leadingDecimalPoint: .8675309, andTrailing: 8675309.,
|
||||
positiveSign: +1,
|
||||
trailingComma: 'in objects', andIn: ['arrays',],
|
||||
"backwardsCompatible": "with JSON",
|
||||
}
|
||||
```
|
||||
|
||||
## Specification
|
||||
For a detailed explanation of the JSON5 format, please read the [official
|
||||
specification](https://json5.github.io/json5-spec/).
|
||||
|
||||
## Installation
|
||||
### Node.js
|
||||
```sh
|
||||
npm install json5
|
||||
```
|
||||
|
||||
```js
|
||||
const JSON5 = require('json5')
|
||||
```
|
||||
|
||||
### Browsers
|
||||
```html
|
||||
<script src="https://unpkg.com/json5@^1.0.0"></script>
|
||||
```
|
||||
|
||||
This will create a global `JSON5` variable.
|
||||
|
||||
## API
|
||||
The JSON5 API is compatible with the [JSON API].
|
||||
|
||||
[JSON API]:
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
|
||||
|
||||
### JSON5.parse()
|
||||
Parses a JSON5 string, constructing the JavaScript value or object described by
|
||||
the string. An optional reviver function can be provided to perform a
|
||||
transformation on the resulting object before it is returned.
|
||||
|
||||
#### Syntax
|
||||
JSON5.parse(text[, reviver])
|
||||
|
||||
#### Parameters
|
||||
- `text`: The string to parse as JSON5.
|
||||
- `reviver`: If a function, this prescribes how the value originally produced by
|
||||
parsing is transformed, before being returned.
|
||||
|
||||
#### Return value
|
||||
The object corresponding to the given JSON5 text.
|
||||
|
||||
### JSON5.stringify()
|
||||
Converts a JavaScript value to a JSON5 string, optionally replacing values if a
|
||||
replacer function is specified, or optionally including only the specified
|
||||
properties if a replacer array is specified.
|
||||
|
||||
#### Syntax
|
||||
JSON5.stringify(value[, replacer[, space]])
|
||||
JSON5.stringify(value[, options])
|
||||
|
||||
#### Parameters
|
||||
- `value`: The value to convert to a JSON5 string.
|
||||
- `replacer`: A function that alters the behavior of the stringification
|
||||
process, or an array of String and Number objects that serve as a whitelist
|
||||
for selecting/filtering the properties of the value object to be included in
|
||||
the JSON5 string. If this value is null or not provided, all properties of the
|
||||
object are included in the resulting JSON5 string.
|
||||
- `space`: A String or Number object that's used to insert white space into the
|
||||
output JSON5 string for readability purposes. If this is a Number, it
|
||||
indicates the number of space characters to use as white space; this number is
|
||||
capped at 10 (if it is greater, the value is just 10). Values less than 1
|
||||
indicate that no space should be used. If this is a String, the string (or the
|
||||
first 10 characters of the string, if it's longer than that) is used as white
|
||||
space. If this parameter is not provided (or is null), no white space is used.
|
||||
If white space is used, trailing commas will be used in objects and arrays.
|
||||
- `options`: An object with the following properties:
|
||||
- `replacer`: Same as the `replacer` parameter.
|
||||
- `space`: Same as the `space` parameter.
|
||||
- `quote`: A String representing the quote character to use when serializing
|
||||
strings.
|
||||
|
||||
#### Return value
|
||||
A JSON5 string representing the value.
|
||||
|
||||
### Node.js `require()` JSON5 files
|
||||
When using Node.js, you can `require()` JSON5 files by adding the following
|
||||
statement.
|
||||
|
||||
```js
|
||||
require('json5/lib/register')
|
||||
```
|
||||
|
||||
Then you can load a JSON5 file with a Node.js `require()` statement. For
|
||||
example:
|
||||
|
||||
```js
|
||||
const config = require('./config.json5')
|
||||
```
|
||||
|
||||
## CLI
|
||||
Since JSON is more widely used than JSON5, this package includes a CLI for
|
||||
converting JSON5 to JSON and for validating the syntax of JSON5 documents.
|
||||
|
||||
### Installation
|
||||
```sh
|
||||
npm install --global json5
|
||||
```
|
||||
|
||||
### Usage
|
||||
```sh
|
||||
json5 [options] <file>
|
||||
```
|
||||
|
||||
If `<file>` is not provided, then STDIN is used.
|
||||
|
||||
#### Options:
|
||||
- `-s`, `--space`: The number of spaces to indent or `t` for tabs
|
||||
- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT
|
||||
- `-v`, `--validate`: Validate JSON5 but do not output JSON
|
||||
- `-V`, `--version`: Output the version number
|
||||
- `-h`, `--help`: Output usage information
|
||||
|
||||
## Contibuting
|
||||
### Development
|
||||
```sh
|
||||
git clone https://github.com/json5/json5
|
||||
cd json5
|
||||
npm install
|
||||
```
|
||||
|
||||
When contributing code, please write relevant tests and run `npm test` and `npm
|
||||
run lint` before submitting pull requests. Please use an editor that supports
|
||||
[EditorConfig](http://editorconfig.org/).
|
||||
|
||||
### Issues
|
||||
To report bugs or request features regarding the JSON5 data format, please
|
||||
submit an issue to the [official specification
|
||||
repository](https://github.com/json5/json5-spec).
|
||||
|
||||
To report bugs or request features regarding the JavaScript implentation of
|
||||
JSON5, please submit an issue to this repository.
|
||||
|
||||
## License
|
||||
MIT. See [LICENSE.md](./LICENSE.md) for details.
|
||||
|
||||
## Credits
|
||||
[Assem Kishore](https://github.com/aseemk) founded this project.
|
||||
|
||||
[Michael Bolin](http://bolinfest.com/) independently arrived at and published
|
||||
some of these same ideas with awesome explanations and detail. Recommended
|
||||
reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)
|
||||
|
||||
[Douglas Crockford](http://www.crockford.com/) of course designed and built
|
||||
JSON, but his state machine diagrams on the [JSON website](http://json.org/), as
|
||||
cheesy as it may sound, gave us motivation and confidence that building a new
|
||||
parser to implement these ideas was within reach! The original
|
||||
implementation of JSON5 was also modeled directly off of Doug’s open-source
|
||||
[json_parse.js] parser. We’re grateful for that clean and well-documented
|
||||
code.
|
||||
|
||||
[json_parse.js]:
|
||||
https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
|
||||
[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
|
||||
supporter, contributing multiple patches and ideas.
|
||||
|
||||
[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original
|
||||
`stringify` method.
|
||||
|
||||
[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely
|
||||
with ES5, wrote the official JSON5 specification, completely rewrote the
|
||||
codebase from the ground up, and is actively maintaining this project.
|
1
web/node_modules/html-webpack-plugin/node_modules/json5/dist/index.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
web/node_modules/html-webpack-plugin/node_modules/json5/lib/cli.js
generated
vendored
Executable file
2
web/node_modules/html-webpack-plugin/node_modules/json5/lib/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _path=require('path');var _path2=_interopRequireDefault(_path);var _minimist=require('minimist');var _minimist2=_interopRequireDefault(_minimist);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var argv=(0,_minimist2.default)(process.argv.slice(2),{alias:{'convert':'c','space':'s','validate':'v','out-file':'o','version':'V','help':'h'},boolean:['convert','validate','version','help'],string:['space','out-file']});if(argv.version){version()}else if(argv.help){usage()}else{var inFilename=argv._[0];var readStream=void 0;if(inFilename){readStream=_fs2.default.createReadStream(inFilename)}else{readStream=process.stdin}var json5='';readStream.on('data',function(data){json5+=data});readStream.on('end',function(){var space=void 0;if(argv.space==='t'||argv.space==='tab'){space='\t'}else{space=Number(argv.space)}var value=void 0;try{value=_2.default.parse(json5);if(!argv.validate){var json=JSON.stringify(value,null,space);var writeStream=void 0;if(argv.convert&&inFilename&&!argv.o){var parsedFilename=_path2.default.parse(inFilename);var outFilename=_path2.default.format(Object.assign(parsedFilename,{base:_path2.default.basename(parsedFilename.base,parsedFilename.ext)+'.json'}));writeStream=_fs2.default.createWriteStream(outFilename)}else if(argv.o){writeStream=_fs2.default.createWriteStream(argv.o)}else{writeStream=process.stdout}writeStream.write(json)}}catch(err){console.error(err.message);process.exit(1)}})}function version(){console.log(_package2.default.version)}function usage(){console.log('\n Usage: json5 [options] <file>\n\n If <file> is not provided, then STDIN is used.\n\n Options:\n\n -s, --space The number of spaces to indent or \'t\' for tabs\n -o, --out-file [file] Output to the specified file, otherwise STDOUT\n -v, --validate Validate JSON5 but do not output JSON\n -V, --version Output the version number\n -h, --help Output usage information')}
|
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/index.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _parse=require('./parse');var _parse2=_interopRequireDefault(_parse);var _stringify=require('./stringify');var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default'];
|
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/parse.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/parse.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/register.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/register.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}require.extensions['.json5']=function(module,filename){var content=_fs2.default.readFileSync(filename,'utf8');try{module.exports=_2.default.parse(content)}catch(err){err.message=filename+': '+err.message;throw err}};
|
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/require.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/require.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
"use strict";require("./register");console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.");
|
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/util.js
generated
vendored
Normal file
1
web/node_modules/html-webpack-plugin/node_modules/json5/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var _unicode=require('../lib/unicode');var unicode=_interopRequireWildcard(_unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)}
|
76
web/node_modules/html-webpack-plugin/node_modules/json5/package.json
generated
vendored
Normal file
76
web/node_modules/html-webpack-plugin/node_modules/json5/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "json5",
|
||||
"version": "1.0.1",
|
||||
"description": "JSON for humans.",
|
||||
"main": "lib/index.js",
|
||||
"bin": "lib/cli.js",
|
||||
"browser": "dist/index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"dist/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "babel-node build/build.js && babel src -d lib && rollup -c",
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"lint": "eslint --fix build src",
|
||||
"prepublishOnly": "npm run lint && npm test && npm run production",
|
||||
"pretest": "cross-env NODE_ENV=test npm run build",
|
||||
"preversion": "npm run lint && npm test && npm run production",
|
||||
"production": "cross-env NODE_ENV=production npm run build",
|
||||
"test": "nyc --reporter=html --reporter=text mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/json5/json5.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"json5",
|
||||
"es5",
|
||||
"es2015",
|
||||
"ecmascript"
|
||||
],
|
||||
"author": "Aseem Kishore <aseem.kishore@gmail.com>",
|
||||
"contributors": [
|
||||
"Max Nanasy <max.nanasy@gmail.com>",
|
||||
"Andrew Eisenberg <andrew@eisenberg.as>",
|
||||
"Jordan Tucker <jordanbtucker@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/json5/json5/issues"
|
||||
},
|
||||
"homepage": "http://json5.org/",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-register": "^6.26.0",
|
||||
"babelrc-rollup": "^3.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"cross-env": "^5.1.4",
|
||||
"del": "^3.0.0",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-promise": "^3.7.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^5.0.4",
|
||||
"nyc": "^11.4.1",
|
||||
"regenerate": "^1.3.3",
|
||||
"rollup": "^0.56.5",
|
||||
"rollup-plugin-babel": "^3.0.3",
|
||||
"rollup-plugin-commonjs": "^9.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.2.0",
|
||||
"rollup-plugin-uglify": "^3.0.0",
|
||||
"sinon": "^4.4.2",
|
||||
"unicode-9.0.0": "^0.7.5"
|
||||
}
|
||||
}
|
87
web/node_modules/html-webpack-plugin/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
87
web/node_modules/html-webpack-plugin/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/webpack/loader-utils/compare/v1.3.0...v1.4.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* the `resourceQuery` is passed to the `interpolateName` method ([#163](https://github.com/webpack/loader-utils/issues/163)) ([cd0e428](https://github.com/webpack/loader-utils/commit/cd0e428))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.3.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support the `[query]` template for the `interpolatedName` method ([#162](https://github.com/webpack/loader-utils/issues/162)) ([469eeba](https://github.com/webpack/loader-utils/commit/469eeba))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.3"></a>
|
||||
## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.2"></a>
|
||||
## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed a hash type extracting in interpolateName ([#137](https://github.com/webpack/loader-utils/issues/137)) ([f8a71f4](https://github.com/webpack/loader-utils/commit/f8a71f4))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **isUrlRequest:** better handle absolute urls and non standards ([#134](https://github.com/webpack/loader-utils/issues/134)) ([aca43da](https://github.com/webpack/loader-utils/commit/aca43da))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* PR [#79](https://github.com/webpack/loader-utils/issues/79) ([#135](https://github.com/webpack/loader-utils/issues/135)) ([73d350a](https://github.com/webpack/loader-utils/commit/73d350a))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/webpack/loader-utils/compare/v1.1.0...v1.2.0) (2018-12-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **interpolateName:** support `[contenthash]`
|
||||
|
||||
### Fixes
|
||||
|
||||
* **urlToRequest:** empty urls are not rewritten to relative requests
|
||||
* **urlToRequest:** don't rewrite absolute urls
|
||||
* **isUrlRequest:** ignore all url with `extension` (like `moz-extension:`, `ms-browser-extension:` and etc)
|
||||
* **isUrlRequest:** ignore `about:blank`
|
||||
* **interpolateName:** failing explicitly when ran out of emoji
|
||||
* **interpolateName:** `[hash]` token regex in interpolate string to capture any hash algorithm name
|
||||
* **interpolateName:** parse string for emoji count before use
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
|
||||
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
|
20
web/node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
275
web/node_modules/html-webpack-plugin/node_modules/loader-utils/README.md
generated
vendored
Normal file
275
web/node_modules/html-webpack-plugin/node_modules/loader-utils/README.md
generated
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
# loader-utils
|
||||
|
||||
## Methods
|
||||
|
||||
### `getOptions`
|
||||
|
||||
Recommended way to retrieve the options of a loader invocation:
|
||||
|
||||
```javascript
|
||||
// inside your loader
|
||||
const options = loaderUtils.getOptions(this);
|
||||
```
|
||||
|
||||
1. If `this.query` is a string:
|
||||
- Tries to parse the query string and returns a new object
|
||||
- Throws if it's not a valid query string
|
||||
2. If `this.query` is object-like, it just returns `this.query`
|
||||
3. In any other case, it just returns `null`
|
||||
|
||||
**Please note:** The returned `options` object is *read-only*. It may be re-used across multiple invocations.
|
||||
If you pass it on to another library, make sure to make a *deep copy* of it:
|
||||
|
||||
```javascript
|
||||
const options = Object.assign(
|
||||
{},
|
||||
defaultOptions,
|
||||
loaderUtils.getOptions(this) // it is safe to pass null to Object.assign()
|
||||
);
|
||||
// don't forget nested objects or arrays
|
||||
options.obj = Object.assign({}, options.obj);
|
||||
options.arr = options.arr.slice();
|
||||
someLibrary(options);
|
||||
```
|
||||
|
||||
[clone](https://www.npmjs.com/package/clone) is a good library to make a deep copy of the options.
|
||||
|
||||
#### Options as query strings
|
||||
|
||||
If the loader options have been passed as loader query string (`loader?some¶ms`), the string is parsed by using [`parseQuery`](#parsequery).
|
||||
|
||||
### `parseQuery`
|
||||
|
||||
Parses a passed string (e.g. `loaderContext.resourceQuery`) as a query string, and returns an object.
|
||||
|
||||
``` javascript
|
||||
const params = loaderUtils.parseQuery(this.resourceQuery); // resource: `file?param1=foo`
|
||||
if (params.param1 === "foo") {
|
||||
// do something
|
||||
}
|
||||
```
|
||||
|
||||
The string is parsed like this:
|
||||
|
||||
``` text
|
||||
-> Error
|
||||
? -> {}
|
||||
?flag -> { flag: true }
|
||||
?+flag -> { flag: true }
|
||||
?-flag -> { flag: false }
|
||||
?xyz=test -> { xyz: "test" }
|
||||
?xyz=1 -> { xyz: "1" } // numbers are NOT parsed
|
||||
?xyz[]=a -> { xyz: ["a"] }
|
||||
?flag1&flag2 -> { flag1: true, flag2: true }
|
||||
?+flag1,-flag2 -> { flag1: true, flag2: false }
|
||||
?xyz[]=a,xyz[]=b -> { xyz: ["a", "b"] }
|
||||
?a%2C%26b=c%2C%26d -> { "a,&b": "c,&d" }
|
||||
?{data:{a:1},isJSON5:true} -> { data: { a: 1 }, isJSON5: true }
|
||||
```
|
||||
|
||||
### `stringifyRequest`
|
||||
|
||||
Turns a request into a string that can be used inside `require()` or `import` while avoiding absolute paths.
|
||||
Use it instead of `JSON.stringify(...)` if you're generating code inside a loader.
|
||||
|
||||
**Why is this necessary?** Since webpack calculates the hash before module paths are translated into module ids, we must avoid absolute paths to ensure
|
||||
consistent hashes across different compilations.
|
||||
|
||||
This function:
|
||||
|
||||
- resolves absolute requests into relative requests if the request and the module are on the same hard drive
|
||||
- replaces `\` with `/` if the request and the module are on the same hard drive
|
||||
- won't change the path at all if the request and the module are on different hard drives
|
||||
- applies `JSON.stringify` to the result
|
||||
|
||||
```javascript
|
||||
loaderUtils.stringifyRequest(this, "./test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, ".\\test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test");
|
||||
// "\"test\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test/lib/index.js");
|
||||
// "\"test/lib/index.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "otherLoader?andConfig!test?someConfig");
|
||||
// "\"otherLoader?andConfig!test?someConfig\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, require.resolve("test"));
|
||||
// "\"../node_modules/some-loader/lib/test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"../../test.js\"" (on Windows, in case the module and the request are on the same drive)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"C:\\module\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "\\\\network-drive\\test.js");
|
||||
// "\"\\\\network-drive\\\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
```
|
||||
|
||||
### `urlToRequest`
|
||||
|
||||
Converts some resource URL to a webpack module request.
|
||||
|
||||
> i Before call `urlToRequest` you need call `isUrlRequest` to ensure it is requestable url
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
|
||||
if (loaderUtils.isUrlRequest(url)) {
|
||||
// Logic for requestable url
|
||||
const request = loaderUtils.urlToRequest(url);
|
||||
} else {
|
||||
// Logic for not requestable url
|
||||
}
|
||||
```
|
||||
|
||||
Simple example:
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "./path/to/module.js"
|
||||
```
|
||||
|
||||
#### Module URLs
|
||||
|
||||
Any URL containing a `~` will be interpreted as a module request. Anything after the `~` will be considered the request path.
|
||||
|
||||
```javascript
|
||||
const url = "~path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "path/to/module.js"
|
||||
```
|
||||
|
||||
#### Root-relative URLs
|
||||
|
||||
URLs that are root-relative (start with `/`) can be resolved relative to some arbitrary path by using the `root` parameter:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "./root";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "./root/path/to/module.js"
|
||||
```
|
||||
|
||||
To convert a root-relative URL into a module URL, specify a `root` value that starts with `~`:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "~";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "path/to/module.js"
|
||||
```
|
||||
|
||||
### `interpolateName`
|
||||
|
||||
Interpolates a filename template using multiple placeholders and/or a regular expression.
|
||||
The template and regular expression are set as query params called `name` and `regExp` on the current loader's context.
|
||||
|
||||
```javascript
|
||||
const interpolatedName = loaderUtils.interpolateName(loaderContext, name, options);
|
||||
```
|
||||
|
||||
The following tokens are replaced in the `name` parameter:
|
||||
|
||||
* `[ext]` the extension of the resource
|
||||
* `[name]` the basename of the resource
|
||||
* `[path]` the path of the resource relative to the `context` query parameter or option.
|
||||
* `[folder]` the folder the resource is in
|
||||
* `[query]` the queryof the resource, i.e. `?foo=bar`
|
||||
* `[emoji]` a random emoji representation of `options.content`
|
||||
* `[emoji:<length>]` same as above, but with a customizable number of emojis
|
||||
* `[contenthash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:contenthash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[hash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:hash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[N]` the N-th match obtained from matching the current file name against `options.regExp`
|
||||
|
||||
In loader context `[hash]` and `[contenthash]` are the same, but we recommend using `[contenthash]` for avoid misleading.
|
||||
|
||||
Examples
|
||||
|
||||
``` javascript
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext][query]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js?foo=bar
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[contenthash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/page.html"
|
||||
loaderUtils.interpolateName(loaderContext, "html-[hash:6].html", { content: ... });
|
||||
// => html-9473fd.html
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/flash.txt"
|
||||
loaderUtils.interpolateName(loaderContext, "[hash]", { content: ... });
|
||||
// => c31e9820c001c9c4a86bce33ce43b679
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji]", { content: ... });
|
||||
// => 👍
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji:4]", { content: ... });
|
||||
// => 🙍🏢📤🐝
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[sha512:hash:base64:7].[ext]", { content: ... });
|
||||
// => 2BKDTjl.png
|
||||
// use sha512 hash instead of md5 and with only 7 chars of base64
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/myself.png"
|
||||
// loaderContext.query.name =
|
||||
loaderUtils.interpolateName(loaderContext, "picture.png");
|
||||
// => picture.png
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/dir/file.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[path][name].[ext]?[hash]", { content: ... });
|
||||
// => /app/dir/file.png?9473fdd0d880a43c21b7778d34872157
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/page-home.js"
|
||||
loaderUtils.interpolateName(loaderContext, "script-[1].[ext]", { regExp: "page-(.*)\\.js", content: ... });
|
||||
// => script-home.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(
|
||||
loaderContext,
|
||||
(resourcePath, resourceQuery) => {
|
||||
// resourcePath - `/app/js/javascript.js`
|
||||
// resourceQuery - `?foo=bar`
|
||||
|
||||
return "js/[hash].script.[ext]";
|
||||
},
|
||||
{ content: ... }
|
||||
);
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
```
|
||||
|
||||
### `getHashDigest`
|
||||
|
||||
``` javascript
|
||||
const digestString = loaderUtils.getHashDigest(buffer, hashType, digestType, maxLength);
|
||||
```
|
||||
|
||||
* `buffer` the content that should be hashed
|
||||
* `hashType` one of `sha1`, `md5`, `sha256`, `sha512` or any other node.js supported hash type
|
||||
* `digestType` one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* `maxLength` the maximum length in chars
|
||||
|
||||
## License
|
||||
|
||||
MIT (http://www.opensource.org/licenses/mit-license.php)
|
16
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
16
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getCurrentRequest(loaderContext) {
|
||||
if (loaderContext.currentRequest) {
|
||||
return loaderContext.currentRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getCurrentRequest;
|
69
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
69
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
const baseEncodeTables = {
|
||||
26: 'abcdefghijklmnopqrstuvwxyz',
|
||||
32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
|
||||
36: '0123456789abcdefghijklmnopqrstuvwxyz',
|
||||
49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
|
||||
52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
|
||||
62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
|
||||
};
|
||||
|
||||
function encodeBufferToBase(buffer, base) {
|
||||
const encodeTable = baseEncodeTables[base];
|
||||
if (!encodeTable) {
|
||||
throw new Error('Unknown encoding base' + base);
|
||||
}
|
||||
|
||||
const readLength = buffer.length;
|
||||
const Big = require('big.js');
|
||||
|
||||
Big.RM = Big.DP = 0;
|
||||
let b = new Big(0);
|
||||
|
||||
for (let i = readLength - 1; i >= 0; i--) {
|
||||
b = b.times(256).plus(buffer[i]);
|
||||
}
|
||||
|
||||
let output = '';
|
||||
while (b.gt(0)) {
|
||||
output = encodeTable[b.mod(base)] + output;
|
||||
b = b.div(base);
|
||||
}
|
||||
|
||||
Big.DP = 20;
|
||||
Big.RM = 1;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function getHashDigest(buffer, hashType, digestType, maxLength) {
|
||||
hashType = hashType || 'md5';
|
||||
maxLength = maxLength || 9999;
|
||||
|
||||
const hash = require('crypto').createHash(hashType);
|
||||
|
||||
hash.update(buffer);
|
||||
|
||||
if (
|
||||
digestType === 'base26' ||
|
||||
digestType === 'base32' ||
|
||||
digestType === 'base36' ||
|
||||
digestType === 'base49' ||
|
||||
digestType === 'base52' ||
|
||||
digestType === 'base58' ||
|
||||
digestType === 'base62' ||
|
||||
digestType === 'base64'
|
||||
) {
|
||||
return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
|
||||
0,
|
||||
maxLength
|
||||
);
|
||||
} else {
|
||||
return hash.digest(digestType || 'hex').substr(0, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = getHashDigest;
|
20
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
20
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const parseQuery = require('./parseQuery');
|
||||
|
||||
function getOptions(loaderContext) {
|
||||
const query = loaderContext.query;
|
||||
|
||||
if (typeof query === 'string' && query !== '') {
|
||||
return parseQuery(loaderContext.query);
|
||||
}
|
||||
|
||||
if (!query || typeof query !== 'object') {
|
||||
// Not object-like queries are not supported.
|
||||
return null;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
module.exports = getOptions;
|
16
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
16
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getRemainingRequest(loaderContext) {
|
||||
if (loaderContext.remainingRequest) {
|
||||
return loaderContext.remainingRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex + 1)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getRemainingRequest;
|
23
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
23
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
const getOptions = require('./getOptions');
|
||||
const parseQuery = require('./parseQuery');
|
||||
const stringifyRequest = require('./stringifyRequest');
|
||||
const getRemainingRequest = require('./getRemainingRequest');
|
||||
const getCurrentRequest = require('./getCurrentRequest');
|
||||
const isUrlRequest = require('./isUrlRequest');
|
||||
const urlToRequest = require('./urlToRequest');
|
||||
const parseString = require('./parseString');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
const interpolateName = require('./interpolateName');
|
||||
|
||||
exports.getOptions = getOptions;
|
||||
exports.parseQuery = parseQuery;
|
||||
exports.stringifyRequest = stringifyRequest;
|
||||
exports.getRemainingRequest = getRemainingRequest;
|
||||
exports.getCurrentRequest = getCurrentRequest;
|
||||
exports.isUrlRequest = isUrlRequest;
|
||||
exports.urlToRequest = urlToRequest;
|
||||
exports.parseString = parseString;
|
||||
exports.getHashDigest = getHashDigest;
|
||||
exports.interpolateName = interpolateName;
|
151
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
151
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const emojisList = require('emojis-list');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
|
||||
const emojiRegex = /[\uD800-\uDFFF]./;
|
||||
const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
|
||||
const emojiCache = {};
|
||||
|
||||
function encodeStringToEmoji(content, length) {
|
||||
if (emojiCache[content]) {
|
||||
return emojiCache[content];
|
||||
}
|
||||
|
||||
length = length || 1;
|
||||
|
||||
const emojis = [];
|
||||
|
||||
do {
|
||||
if (!emojiList.length) {
|
||||
throw new Error('Ran out of emoji');
|
||||
}
|
||||
|
||||
const index = Math.floor(Math.random() * emojiList.length);
|
||||
|
||||
emojis.push(emojiList[index]);
|
||||
emojiList.splice(index, 1);
|
||||
} while (--length > 0);
|
||||
|
||||
const emojiEncoding = emojis.join('');
|
||||
|
||||
emojiCache[content] = emojiEncoding;
|
||||
|
||||
return emojiEncoding;
|
||||
}
|
||||
|
||||
function interpolateName(loaderContext, name, options) {
|
||||
let filename;
|
||||
|
||||
const hasQuery =
|
||||
loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
|
||||
|
||||
if (typeof name === 'function') {
|
||||
filename = name(
|
||||
loaderContext.resourcePath,
|
||||
hasQuery ? loaderContext.resourceQuery : undefined
|
||||
);
|
||||
} else {
|
||||
filename = name || '[hash].[ext]';
|
||||
}
|
||||
|
||||
const context = options.context;
|
||||
const content = options.content;
|
||||
const regExp = options.regExp;
|
||||
|
||||
let ext = 'bin';
|
||||
let basename = 'file';
|
||||
let directory = '';
|
||||
let folder = '';
|
||||
let query = '';
|
||||
|
||||
if (loaderContext.resourcePath) {
|
||||
const parsed = path.parse(loaderContext.resourcePath);
|
||||
let resourcePath = loaderContext.resourcePath;
|
||||
|
||||
if (parsed.ext) {
|
||||
ext = parsed.ext.substr(1);
|
||||
}
|
||||
|
||||
if (parsed.dir) {
|
||||
basename = parsed.name;
|
||||
resourcePath = parsed.dir + path.sep;
|
||||
}
|
||||
|
||||
if (typeof context !== 'undefined') {
|
||||
directory = path
|
||||
.relative(context, resourcePath + '_')
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/\.\.(\/)?/g, '_$1');
|
||||
directory = directory.substr(0, directory.length - 1);
|
||||
} else {
|
||||
directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
|
||||
}
|
||||
|
||||
if (directory.length === 1) {
|
||||
directory = '';
|
||||
} else if (directory.length > 1) {
|
||||
folder = path.basename(directory);
|
||||
}
|
||||
}
|
||||
|
||||
if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
|
||||
query = loaderContext.resourceQuery;
|
||||
|
||||
const hashIdx = query.indexOf('#');
|
||||
|
||||
if (hashIdx >= 0) {
|
||||
query = query.substr(0, hashIdx);
|
||||
}
|
||||
}
|
||||
|
||||
let url = filename;
|
||||
|
||||
if (content) {
|
||||
// Match hash template
|
||||
url = url
|
||||
// `hash` and `contenthash` are same in `loader-utils` context
|
||||
// let's keep `hash` for backward compatibility
|
||||
.replace(
|
||||
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
|
||||
(all, hashType, digestType, maxLength) =>
|
||||
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
|
||||
)
|
||||
.replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
|
||||
encodeStringToEmoji(content, parseInt(length, 10))
|
||||
);
|
||||
}
|
||||
|
||||
url = url
|
||||
.replace(/\[ext\]/gi, () => ext)
|
||||
.replace(/\[name\]/gi, () => basename)
|
||||
.replace(/\[path\]/gi, () => directory)
|
||||
.replace(/\[folder\]/gi, () => folder)
|
||||
.replace(/\[query\]/gi, () => query);
|
||||
|
||||
if (regExp && loaderContext.resourcePath) {
|
||||
const match = loaderContext.resourcePath.match(new RegExp(regExp));
|
||||
|
||||
match &&
|
||||
match.forEach((matched, i) => {
|
||||
url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
typeof loaderContext.options === 'object' &&
|
||||
typeof loaderContext.options.customInterpolateName === 'function'
|
||||
) {
|
||||
url = loaderContext.options.customInterpolateName.call(
|
||||
loaderContext,
|
||||
url,
|
||||
name,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = interpolateName;
|
31
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
31
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
function isUrlRequest(url, root) {
|
||||
// An URL is not an request if
|
||||
|
||||
// 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path.win32.isAbsolute(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. It's a protocol-relative
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. It's some kind of url for a template
|
||||
if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. It's also not an request if root isn't set and it's a root-relative url
|
||||
if ((root === undefined || root === false) && /^\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isUrlRequest;
|
68
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
68
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
'use strict';
|
||||
|
||||
const JSON5 = require('json5');
|
||||
|
||||
const specialValues = {
|
||||
null: null,
|
||||
true: true,
|
||||
false: false,
|
||||
};
|
||||
|
||||
function parseQuery(query) {
|
||||
if (query.substr(0, 1) !== '?') {
|
||||
throw new Error(
|
||||
"A valid query string passed to parseQuery should begin with '?'"
|
||||
);
|
||||
}
|
||||
|
||||
query = query.substr(1);
|
||||
|
||||
if (!query) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
|
||||
return JSON5.parse(query);
|
||||
}
|
||||
|
||||
const queryArgs = query.split(/[,&]/g);
|
||||
const result = {};
|
||||
|
||||
queryArgs.forEach((arg) => {
|
||||
const idx = arg.indexOf('=');
|
||||
|
||||
if (idx >= 0) {
|
||||
let name = arg.substr(0, idx);
|
||||
let value = decodeURIComponent(arg.substr(idx + 1));
|
||||
|
||||
if (specialValues.hasOwnProperty(value)) {
|
||||
value = specialValues[value];
|
||||
}
|
||||
|
||||
if (name.substr(-2) === '[]') {
|
||||
name = decodeURIComponent(name.substr(0, name.length - 2));
|
||||
|
||||
if (!Array.isArray(result[name])) {
|
||||
result[name] = [];
|
||||
}
|
||||
|
||||
result[name].push(value);
|
||||
} else {
|
||||
name = decodeURIComponent(name);
|
||||
result[name] = value;
|
||||
}
|
||||
} else {
|
||||
if (arg.substr(0, 1) === '-') {
|
||||
result[decodeURIComponent(arg.substr(1))] = false;
|
||||
} else if (arg.substr(0, 1) === '+') {
|
||||
result[decodeURIComponent(arg.substr(1))] = true;
|
||||
} else {
|
||||
result[decodeURIComponent(arg)] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = parseQuery;
|
23
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
23
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
function parseString(str) {
|
||||
try {
|
||||
if (str[0] === '"') {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
if (str[0] === "'" && str.substr(str.length - 1) === "'") {
|
||||
return parseString(
|
||||
str
|
||||
.replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
|
||||
.replace(/^'|'$/g, '"')
|
||||
);
|
||||
}
|
||||
|
||||
return JSON.parse('"' + str + '"');
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parseString;
|
51
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
51
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const matchRelativePath = /^\.\.?[/\\]/;
|
||||
|
||||
function isAbsolutePath(str) {
|
||||
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
|
||||
}
|
||||
|
||||
function isRelativePath(str) {
|
||||
return matchRelativePath.test(str);
|
||||
}
|
||||
|
||||
function stringifyRequest(loaderContext, request) {
|
||||
const splitted = request.split('!');
|
||||
const context =
|
||||
loaderContext.context ||
|
||||
(loaderContext.options && loaderContext.options.context);
|
||||
|
||||
return JSON.stringify(
|
||||
splitted
|
||||
.map((part) => {
|
||||
// First, separate singlePath from query, because the query might contain paths again
|
||||
const splittedPart = part.match(/^(.*?)(\?.*)/);
|
||||
const query = splittedPart ? splittedPart[2] : '';
|
||||
let singlePath = splittedPart ? splittedPart[1] : part;
|
||||
|
||||
if (isAbsolutePath(singlePath) && context) {
|
||||
singlePath = path.relative(context, singlePath);
|
||||
|
||||
if (isAbsolutePath(singlePath)) {
|
||||
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
||||
// In this case, we leave the path platform-specific without replacing any separators.
|
||||
// @see https://github.com/webpack/loader-utils/pull/14
|
||||
return singlePath + query;
|
||||
}
|
||||
|
||||
if (isRelativePath(singlePath) === false) {
|
||||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
|
||||
singlePath = './' + singlePath;
|
||||
}
|
||||
}
|
||||
|
||||
return singlePath.replace(/\\/g, '/') + query;
|
||||
})
|
||||
.join('!')
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = stringifyRequest;
|
60
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
60
web/node_modules/html-webpack-plugin/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
// we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
|
||||
function urlToRequest(url, root) {
|
||||
// Do not rewrite an empty url
|
||||
if (url === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
const moduleRequestRegex = /^[^?]*~/;
|
||||
let request;
|
||||
|
||||
if (matchNativeWin32Path.test(url)) {
|
||||
// absolute windows path, keep it
|
||||
request = url;
|
||||
} else if (root !== undefined && root !== false && /^\//.test(url)) {
|
||||
// if root is set and the url is root-relative
|
||||
switch (typeof root) {
|
||||
// 1. root is a string: root is prefixed to the url
|
||||
case 'string':
|
||||
// special case: `~` roots convert to module request
|
||||
if (moduleRequestRegex.test(root)) {
|
||||
request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
|
||||
} else {
|
||||
request = root + url;
|
||||
}
|
||||
break;
|
||||
// 2. root is `true`: absolute paths are allowed
|
||||
// *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
|
||||
case 'boolean':
|
||||
request = url;
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
"Unexpected parameters to loader-utils 'urlToRequest': url = " +
|
||||
url +
|
||||
', root = ' +
|
||||
root +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
} else if (/^\.\.?\//.test(url)) {
|
||||
// A relative url stays
|
||||
request = url;
|
||||
} else {
|
||||
// every other url is threaded like a relative url
|
||||
request = './' + url;
|
||||
}
|
||||
|
||||
// A `~` makes the url an module
|
||||
if (moduleRequestRegex.test(request)) {
|
||||
request = request.replace(moduleRequestRegex, '');
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = urlToRequest;
|
39
web/node_modules/html-webpack-plugin/node_modules/loader-utils/package.json
generated
vendored
Normal file
39
web/node_modules/html-webpack-plugin/node_modules/loader-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "loader-utils",
|
||||
"version": "1.4.0",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"description": "utils for webpack loaders",
|
||||
"dependencies": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"pretest": "yarn lint",
|
||||
"test": "jest",
|
||||
"test:ci": "jest --coverage",
|
||||
"release": "yarn test && standard-version"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webpack/loader-utils.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.2",
|
||||
"eslint": "^5.11.0",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"jest": "^21.2.1",
|
||||
"prettier": "^1.19.1",
|
||||
"standard-version": "^4.0.0"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
}
|
89
web/node_modules/html-webpack-plugin/package.json
generated
vendored
Normal file
89
web/node_modules/html-webpack-plugin/package.json
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"name": "html-webpack-plugin",
|
||||
"version": "4.5.0",
|
||||
"license": "MIT",
|
||||
"description": "Simplifies creation of HTML files to serve your webpack bundles",
|
||||
"author": "Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)",
|
||||
"main": "index.js",
|
||||
"types": "typings.d.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.js",
|
||||
"default_index.ejs",
|
||||
"typings.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "semistandard",
|
||||
"posttest": "tsc",
|
||||
"commit": "git-cz",
|
||||
"build-examples": "node examples/build-examples.js",
|
||||
"test": "jest --runInBand --verbose --coverage",
|
||||
"test-watch": "jest --runInBand --watch",
|
||||
"puml": "npx puml generate flow.puml -o flow.png",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"semistandard": {
|
||||
"ignore": [
|
||||
"examples/*/dist/**/*.*"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/loader-utils": "1.1.3",
|
||||
"@types/node": "11.13.9",
|
||||
"appcache-webpack-plugin": "1.4.0",
|
||||
"commitizen": "4.0.3",
|
||||
"css-loader": "2.1.1",
|
||||
"cz-conventional-changelog": "2.1.0",
|
||||
"dir-compare": "1.7.2",
|
||||
"file-loader": "3.0.1",
|
||||
"html-loader": "0.5.5",
|
||||
"jest": "24.7.1",
|
||||
"mini-css-extract-plugin": "0.6.0",
|
||||
"pug": "2.0.3",
|
||||
"pug-loader": "2.4.0",
|
||||
"rimraf": "2.6.3",
|
||||
"semistandard": "^13.0.1",
|
||||
"standard-version": "5.0.2",
|
||||
"style-loader": "0.23.1",
|
||||
"typescript": "3.8.3",
|
||||
"webpack": "4.35.2",
|
||||
"webpack-recompilation-simulator": "3.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/html-minifier-terser": "^5.0.0",
|
||||
"@types/tapable": "^1.0.5",
|
||||
"@types/webpack": "^4.41.8",
|
||||
"html-minifier-terser": "^5.0.1",
|
||||
"loader-utils": "^1.2.3",
|
||||
"lodash": "^4.17.15",
|
||||
"pretty-error": "^2.1.1",
|
||||
"tapable": "^1.1.3",
|
||||
"util.promisify": "1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "^4.0.0 || ^5.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"plugin",
|
||||
"html",
|
||||
"html-webpack-plugin"
|
||||
],
|
||||
"bugs": "https://github.com/jantimon/html-webpack-plugin/issues",
|
||||
"homepage": "https://github.com/jantimon/html-webpack-plugin",
|
||||
"repository": "https://github.com/jantimon/html-webpack-plugin.git",
|
||||
"engines": {
|
||||
"node": ">=6.9"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"jest": {
|
||||
"watchPathIgnorePatterns": [
|
||||
"<rootDir>/dist"
|
||||
],
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
265
web/node_modules/html-webpack-plugin/typings.d.ts
generated
vendored
Normal file
265
web/node_modules/html-webpack-plugin/typings.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,265 @@
|
|||
import { AsyncSeriesWaterfallHook } from "tapable";
|
||||
import { Compiler, compilation } from 'webpack';
|
||||
import { Options as HtmlMinifierOptions } from "html-minifier-terser";
|
||||
|
||||
export = HtmlWebpackPlugin;
|
||||
|
||||
declare class HtmlWebpackPlugin {
|
||||
constructor(options?: HtmlWebpackPlugin.Options);
|
||||
|
||||
apply(compiler: Compiler): void;
|
||||
|
||||
static getHooks(compilation: compilation.Compilation): HtmlWebpackPlugin.Hooks;
|
||||
|
||||
/**
|
||||
* Static helper to create a tag object to be get injected into the dom
|
||||
*/
|
||||
static createHtmlTagObject(
|
||||
tagName: string,
|
||||
attributes?: { [attributeName: string]: string | boolean },
|
||||
innerHTML?: string
|
||||
): HtmlWebpackPlugin.HtmlTagObject;
|
||||
|
||||
static readonly version: number;
|
||||
}
|
||||
|
||||
declare namespace HtmlWebpackPlugin {
|
||||
type MinifyOptions = HtmlMinifierOptions;
|
||||
|
||||
interface Options extends Partial<ProcessedOptions> {}
|
||||
|
||||
/**
|
||||
* The plugin options after adding default values
|
||||
*/
|
||||
interface ProcessedOptions {
|
||||
/**
|
||||
* Emit the file only if it was changed.
|
||||
* @default true
|
||||
*/
|
||||
cache: boolean;
|
||||
/**
|
||||
* List all entries which should be injected
|
||||
*/
|
||||
chunks: "all" | string[];
|
||||
/**
|
||||
* Allows to control how chunks should be sorted before they are included to the html.
|
||||
* @default 'auto'
|
||||
*/
|
||||
chunksSortMode:
|
||||
| "auto"
|
||||
| "manual"
|
||||
| (((entryNameA: string, entryNameB: string) => number));
|
||||
/**
|
||||
* List all entries which should not be injected
|
||||
*/
|
||||
excludeChunks: string[];
|
||||
/**
|
||||
* Path to the favicon icon
|
||||
*/
|
||||
favicon: false | string;
|
||||
/**
|
||||
* The file to write the HTML to.
|
||||
* Supports subdirectories eg: `assets/admin.html`
|
||||
* @default 'index.html'
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* By default the public path is set to `auto` - that way the html-webpack-plugin will try
|
||||
* to set the publicPath according to the current filename and the webpack publicPath setting
|
||||
*/
|
||||
publicPath: string | 'auto';
|
||||
/**
|
||||
* If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files.
|
||||
* This is useful for cache busting
|
||||
*/
|
||||
hash: boolean;
|
||||
/**
|
||||
* Inject all assets into the given `template` or `templateContent`.
|
||||
*/
|
||||
inject:
|
||||
| false // Don't inject scripts
|
||||
| true // Inject scripts into body
|
||||
| "body" // Inject scripts into body
|
||||
| "head" // Inject scripts into head
|
||||
/**
|
||||
* Set up script loading
|
||||
* blocking will result in <script src="..."></script>
|
||||
* defer will result in <script defer src="..."></script>
|
||||
*
|
||||
* @default 'blocking'
|
||||
*/
|
||||
scriptLoading:
|
||||
| "blocking"
|
||||
| "defer"
|
||||
/**
|
||||
* Inject meta tags
|
||||
*/
|
||||
meta:
|
||||
| false // Disable injection
|
||||
| {
|
||||
[name: string]:
|
||||
| string
|
||||
| false // name content pair e.g. {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`
|
||||
| { [attributeName: string]: string | boolean }; // custom properties e.g. { name:"viewport" content:"width=500, initial-scale=1" }
|
||||
};
|
||||
/**
|
||||
* HTML Minification options accepts the following values:
|
||||
* - Set to `false` to disable minifcation
|
||||
* - Set to `'auto'` to enable minifcation only for production mode
|
||||
* - Set to custom minification according to
|
||||
* {@link https://github.com/kangax/html-minifier#options-quick-reference}
|
||||
*/
|
||||
minify: 'auto' | boolean | MinifyOptions;
|
||||
/**
|
||||
* Render errors into the HTML page
|
||||
*/
|
||||
showErrors: boolean;
|
||||
/**
|
||||
* The `webpack` require path to the template.
|
||||
* @see https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md
|
||||
*/
|
||||
template: string;
|
||||
/**
|
||||
* Allow to use a html string instead of reading from a file
|
||||
*/
|
||||
templateContent:
|
||||
| false // Use the template option instead to load a file
|
||||
| string
|
||||
| ((templateParameters: { [option: string]: any }) => (string | Promise<string>))
|
||||
| Promise<string>;
|
||||
/**
|
||||
* Allows to overwrite the parameters used in the template
|
||||
*/
|
||||
templateParameters:
|
||||
| false // Pass an empty object to the template function
|
||||
| ((
|
||||
compilation: any,
|
||||
assets: {
|
||||
publicPath: string;
|
||||
js: Array<string>;
|
||||
css: Array<string>;
|
||||
manifest?: string;
|
||||
favicon?: string;
|
||||
},
|
||||
assetTags: {
|
||||
headTags: HtmlTagObject[];
|
||||
bodyTags: HtmlTagObject[];
|
||||
},
|
||||
options: ProcessedOptions
|
||||
) => { [option: string]: any } | Promise<{ [option: string]: any }>)
|
||||
| { [option: string]: any };
|
||||
/**
|
||||
* The title to use for the generated HTML document
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Enforce self closing tags e.g. <link />
|
||||
*/
|
||||
xhtml: boolean;
|
||||
/**
|
||||
* In addition to the options actually used by this plugin, you can use this hash to pass arbitrary data through
|
||||
* to your template.
|
||||
*/
|
||||
[option: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The values which are available during template execution
|
||||
*
|
||||
* Please keep in mind that the `templateParameter` options allows to change them
|
||||
*/
|
||||
interface TemplateParameter {
|
||||
compilation: any;
|
||||
htmlWebpackPlugin: {
|
||||
tags: {
|
||||
headTags: HtmlTagObject[];
|
||||
bodyTags: HtmlTagObject[];
|
||||
};
|
||||
files: {
|
||||
publicPath: string;
|
||||
js: Array<string>;
|
||||
css: Array<string>;
|
||||
manifest?: string;
|
||||
favicon?: string;
|
||||
};
|
||||
options: Options;
|
||||
};
|
||||
webpackConfig: any;
|
||||
}
|
||||
|
||||
interface Hooks {
|
||||
alterAssetTags: AsyncSeriesWaterfallHook<{
|
||||
assetTags: {
|
||||
scripts: HtmlTagObject[];
|
||||
styles: HtmlTagObject[];
|
||||
meta: HtmlTagObject[];
|
||||
};
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
|
||||
alterAssetTagGroups: AsyncSeriesWaterfallHook<{
|
||||
headTags: HtmlTagObject[];
|
||||
bodyTags: HtmlTagObject[];
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
|
||||
afterTemplateExecution: AsyncSeriesWaterfallHook<{
|
||||
html: string;
|
||||
headTags: HtmlTagObject[];
|
||||
bodyTags: HtmlTagObject[];
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
|
||||
beforeAssetTagGeneration: AsyncSeriesWaterfallHook<{
|
||||
assets: {
|
||||
publicPath: string;
|
||||
js: Array<string>;
|
||||
css: Array<string>;
|
||||
favicon?: string;
|
||||
manifest?: string;
|
||||
};
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
|
||||
beforeEmit: AsyncSeriesWaterfallHook<{
|
||||
html: string;
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
|
||||
afterEmit: AsyncSeriesWaterfallHook<{
|
||||
outputName: string;
|
||||
plugin: HtmlWebpackPlugin;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tag element according to the htmlWebpackPlugin object notation
|
||||
*/
|
||||
interface HtmlTagObject {
|
||||
/**
|
||||
* Attributes of the html tag
|
||||
* E.g. `{'disabled': true, 'value': 'demo'}`
|
||||
*/
|
||||
attributes: {
|
||||
[attributeName: string]: string | boolean;
|
||||
};
|
||||
/**
|
||||
* The tag name e.g. `'div'`
|
||||
*/
|
||||
tagName: string;
|
||||
/**
|
||||
* The inner HTML
|
||||
*/
|
||||
innerHTML?: string;
|
||||
/**
|
||||
* Whether this html must not contain innerHTML
|
||||
* @see https://www.w3.org/TR/html5/syntax.html#void-elements
|
||||
*/
|
||||
voidTag: boolean;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue