aboutsummaryrefslogtreecommitdiff
path: root/node_modules/html-webpack-plugin
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/html-webpack-plugin
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/html-webpack-plugin')
-rw-r--r--node_modules/html-webpack-plugin/CHANGELOG.md13
-rw-r--r--node_modules/html-webpack-plugin/README.md41
-rw-r--r--node_modules/html-webpack-plugin/index.js23
-rw-r--r--node_modules/html-webpack-plugin/lib/chunksorter.js24
-rw-r--r--node_modules/html-webpack-plugin/lib/loader.js2
-rw-r--r--node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE22
-rw-r--r--node_modules/html-webpack-plugin/node_modules/loader-utils/README.md217
-rw-r--r--node_modules/html-webpack-plugin/node_modules/loader-utils/index.js331
l---------node_modules/html-webpack-plugin/node_modules/loader-utils/node_modules/.bin/json51
-rw-r--r--node_modules/html-webpack-plugin/node_modules/loader-utils/package.json31
-rw-r--r--node_modules/html-webpack-plugin/package.json10
11 files changed, 679 insertions, 36 deletions
diff --git a/node_modules/html-webpack-plugin/CHANGELOG.md b/node_modules/html-webpack-plugin/CHANGELOG.md
index 1aca56867..25d1d2d47 100644
--- a/node_modules/html-webpack-plugin/CHANGELOG.md
+++ b/node_modules/html-webpack-plugin/CHANGELOG.md
@@ -1,6 +1,19 @@
Change History
==============
+v2.30.1
+---
+* Revert part the performance optimization (#723) because of #753.
+
+v2.30.0
+---
+* Add manual sort
+* Performance improvements (#723)
+
+v2.29.0
+---
+* Add support for Webpack 3
+
v2.28.0
---
* Backport 3.x void tag for plugin authors
diff --git a/node_modules/html-webpack-plugin/README.md b/node_modules/html-webpack-plugin/README.md
index 46259223e..e0fd037b7 100644
--- a/node_modules/html-webpack-plugin/README.md
+++ b/node_modules/html-webpack-plugin/README.md
@@ -1,6 +1,6 @@
HTML Webpack Plugin
===================
-[![npm version](https://badge.fury.io/js/html-webpack-plugin.svg)](http://badge.fury.io/js/html-webpack-plugin) [![Dependency Status](https://david-dm.org/ampedandwired/html-webpack-plugin.svg)](https://david-dm.org/ampedandwired/html-webpack-plugin) [![Build status](https://travis-ci.org/ampedandwired/html-webpack-plugin.svg)](https://travis-ci.org/ampedandwired/html-webpack-plugin) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/ampedandwired/html-webpack-plugin?svg=true&branch=master)](https://ci.appveyor.com/project/jantimon/html-webpack-plugin) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard) [![bitHound Dependencies](https://www.bithound.io/github/ampedandwired/html-webpack-plugin/badges/dependencies.svg)](https://www.bithound.io/github/ampedandwired/html-webpack-plugin/master/dependencies/npm) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)]()
+[![npm version](https://badge.fury.io/js/html-webpack-plugin.svg)](http://badge.fury.io/js/html-webpack-plugin) [![Dependency Status](https://david-dm.org/jantimon/html-webpack-plugin.svg)](https://david-dm.org/jantimon/html-webpack-plugin) [![Build status](https://travis-ci.org/jantimon/html-webpack-plugin.svg)](https://travis-ci.org/jantimon/html-webpack-plugin) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/jantimon/html-webpack-plugin?svg=true&branch=master)](https://ci.appveyor.com/project/jantimon/html-webpack-plugin) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard) [![bitHound Dependencies](https://www.bithound.io/github/jantimon/html-webpack-plugin/badges/dependencies.svg)](https://www.bithound.io/github/jantimon/html-webpack-plugin/master/dependencies/npm) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)]()
[![NPM](https://nodei.co/npm/html-webpack-plugin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/html-webpack-plugin/)
@@ -9,7 +9,7 @@ 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.
-Maintainer: Jan Nicklas [@jantimon](https://twitter.com/jantimon)
+Maintainer: Jan Nicklas [@jantimon](https://twitter.com/jantimon) and Thomas Sileghem [@mastilver](https://twitter.com/mastilver)
Installation
------------
@@ -21,20 +21,23 @@ $ npm install html-webpack-plugin --save-dev
Third party addons:
-------------
-The html-webpack-plugin provides [hooks](https://github.com/ampedandwired/html-webpack-plugin#events) to extend it to your needs.
+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)
+ * [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-exclude-assets-plugin](https://github.com/jamesjieye/html-webpack-exclude-assets-plugin) for excluding assets using regular expressions
+ * [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 in-line 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
- * [resource-hints-webpack-plugin](https://github.com/jantimon/resource-hints-webpack-plugin) to add resource hints for faster initial page loads
-
+ * [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>`.
+
Basic Usage
-----------
@@ -47,7 +50,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpackConfig = {
entry: 'index.js',
output: {
- path: 'dist',
+ path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [new HtmlWebpackPlugin()]
@@ -83,16 +86,16 @@ Allowed values are as follows:
- `title`: The title to use for the generated HTML document.
- `filename`: The file to write the HTML to. Defaults to `index.html`.
You can specify a subdirectory here too (eg: `assets/admin.html`).
-- `template`: Webpack require path to the template. Please see the [docs](https://github.com/ampedandwired/html-webpack-plugin/blob/master/docs/template-option.md) for details.
+- `template`: Webpack require path to the template. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details.
- `inject`: `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.
- `favicon`: Adds the given favicon path to the output html.
-- `minify`: `{...} | false` Pass a [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference) options object to minify the output.
+- `minify`: `{...} | false` Pass [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference)'s options as object to minify the output.
- `hash`: `true | false` if `true` then append a unique webpack compilation hash to all
included scripts and CSS files. This is useful for cache busting.
- `cache`: `true | false` if `true` (default) try to emit the file only if it was changed.
- `showErrors`: `true | false` if `true` (default) 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`: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' | {function} - default: 'auto'
+- `chunksSortMode`: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' |'manual' | {function} - default: 'auto'
- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk)
- `xhtml`: `true | false` If `true` render the `link` tags as self-closing, XHTML compliant. Default is `false`
@@ -101,7 +104,7 @@ Here's an example webpack config illustrating how to use these options:
{
entry: 'index.js',
output: {
- path: 'dist',
+ path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
@@ -116,9 +119,9 @@ Here's an example webpack config illustrating how to use these options:
FAQ
----
-* [Why is my HTML minified?](https://github.com/ampedandwired/html-webpack-plugin/blob/master/docs/template-option.md)
-* [Why is my `<% ... %>` template not working?](https://github.com/ampedandwired/html-webpack-plugin/blob/master/docs/template-option.md)
-* [How can I use handlebars/pug/ejs as template engine](https://github.com/ampedandwired/html-webpack-plugin/blob/master/docs/template-option.md)
+* [Why is my HTML minified?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
+* [Why is my `<% ... %>` template not working?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
+* [How can I use handlebars/pug/ejs as template engine](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
Generating Multiple HTML Files
------------------------------
@@ -128,7 +131,7 @@ once in your plugins array:
{
entry: 'index.js',
output: {
- path: 'dist',
+ path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
@@ -224,7 +227,7 @@ The following variables are available in the template:
- `webpack`: the webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats)
object. Note that this is the stats object as it was at the time the HTML template
was emitted and as such may not have the full set of stats that are available
- after the wepback run is complete.
+ after the webpack run is complete.
- `webpackConfig`: the webpack configuration that was used for this compilation. This
can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`).
@@ -309,11 +312,11 @@ Note that the callback must be passed the htmlPluginData in order to pass this o
# Contribution
-You're free to contribute to this project by submitting [issues](https://github.com/ampedandwired/html-webpack-plugin/issues) and/or [pull requests](https://github.com/ampedandwired/html-webpack-plugin/pulls). This project is test-driven, so keep in mind that every change and new feature should be covered by tests.
+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).
Before running the tests, make sure to execute `yarn link` and `yarn link html-webpack-plugin` (or the npm variant of this).
# License
-This project is licensed under [MIT](https://github.com/ampedandwired/html-webpack-plugin/blob/master/LICENSE).
+This project is licensed under [MIT](https://github.com/jantimon/html-webpack-plugin/blob/master/LICENSE).
diff --git a/node_modules/html-webpack-plugin/index.js b/node_modules/html-webpack-plugin/index.js
index 40633a68b..f98abce2d 100644
--- a/node_modules/html-webpack-plugin/index.js
+++ b/node_modules/html-webpack-plugin/index.js
@@ -144,7 +144,6 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
.then(function (result) {
var html = result.html;
var assets = result.assets;
- var chunks = result.chunks;
// Prepare script and link tags
var assetTags = self.generateAssetTags(assets);
var pluginArgs = {head: assetTags.head, body: assetTags.body, plugin: self, chunks: chunks, outputName: self.childCompilationOutputName};
@@ -345,7 +344,7 @@ HtmlWebpackPlugin.prototype.sortChunks = function (chunks, sortMode) {
}
// Check if the given sort mode is a valid chunkSorter sort mode
if (typeof chunkSorter[sortMode] !== 'undefined') {
- return chunkSorter[sortMode](chunks);
+ return chunkSorter[sortMode](chunks, this.options.chunks);
}
throw new Error('"' + sortMode + '" is not a valid chunk sort mode');
};
@@ -361,7 +360,11 @@ HtmlWebpackPlugin.prototype.filterChunks = function (chunks, includedChunks, exc
return false;
}
// Skip if the chunk should be lazy loaded
- if (!chunk.initial) {
+ if (typeof chunk.isInitial === 'function') {
+ if (!chunk.isInitial()) {
+ return false;
+ }
+ } else if (!chunk.initial) {
return false;
}
// Skip if the chunks should be filtered and the given chunk was not added explicity
@@ -385,12 +388,12 @@ HtmlWebpackPlugin.prototype.isHotUpdateCompilation = function (assets) {
HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chunks) {
var self = this;
- var webpackStatsJson = compilation.getStats().toJson();
+ var compilationHash = compilation.hash;
// Use the configured public path or build a relative path
var publicPath = typeof compilation.options.output.publicPath !== 'undefined'
// If a hard coded public path exists use it
- ? compilation.mainTemplate.getPublicPath({hash: webpackStatsJson.hash})
+ ? compilation.mainTemplate.getPublicPath({hash: compilationHash})
// If no public path was set get a relative url path
: path.relative(path.resolve(compilation.options.output.path, path.dirname(self.childCompilationOutputName)), compilation.options.output.path)
.split(path.sep).join('/');
@@ -416,8 +419,8 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
// Append a hash for cache busting
if (this.options.hash) {
- assets.manifest = self.appendHash(assets.manifest, webpackStatsJson.hash);
- assets.favicon = self.appendHash(assets.favicon, webpackStatsJson.hash);
+ assets.manifest = self.appendHash(assets.manifest, compilationHash);
+ assets.favicon = self.appendHash(assets.favicon, compilationHash);
}
for (var i = 0; i < chunks.length; i++) {
@@ -434,7 +437,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
// Append a hash for cache busting
if (this.options.hash) {
chunkFiles = chunkFiles.map(function (chunkFile) {
- return self.appendHash(chunkFile, webpackStatsJson.hash);
+ return self.appendHash(chunkFile, compilationHash);
});
}
@@ -522,8 +525,8 @@ HtmlWebpackPlugin.prototype.generateAssetTags = function (assets) {
*/
HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function (html, assets, assetTags) {
var htmlRegExp = /(<html[^>]*>)/i;
- var headRegExp = /(<\/head>)/i;
- var bodyRegExp = /(<\/body>)/i;
+ var headRegExp = /(<\/head\s*>)/i;
+ var bodyRegExp = /(<\/body\s*>)/i;
var body = assetTags.body.map(this.createHtmlTag);
var head = assetTags.head.map(this.createHtmlTag);
diff --git a/node_modules/html-webpack-plugin/lib/chunksorter.js b/node_modules/html-webpack-plugin/lib/chunksorter.js
index 584e01ccb..75f1a11a6 100644
--- a/node_modules/html-webpack-plugin/lib/chunksorter.js
+++ b/node_modules/html-webpack-plugin/lib/chunksorter.js
@@ -81,6 +81,28 @@ module.exports.none = function (chunks) {
};
/**
+ * Sort manually by the chunks
+ * @param {Array} chunks the chunks to sort
+ * @return {Array} The sorted chunks
+ */
+module.exports.manual = function (chunks, specifyChunks) {
+ var chunksResult = [];
+ var filterResult = [];
+ if (Array.isArray(specifyChunks)) {
+ for (var i = 0; i < specifyChunks.length; i++) {
+ filterResult = chunks.filter(function (chunk) {
+ if (chunk.names[0] && chunk.names[0] === specifyChunks[i]) {
+ return true;
+ }
+ return false;
+ });
+ filterResult.length > 0 && chunksResult.push(filterResult[0]);
+ }
+ }
+ return chunksResult;
+};
+
+/**
* Defines the default sorter.
*/
module.exports.auto = module.exports.id;
@@ -88,6 +110,6 @@ module.exports.auto = module.exports.id;
// In webpack 2 the ids have been flipped.
// Therefore the id sort doesn't work the same way as it did for webpack 1
// Luckily the dependency sort is working as expected
-if (require('webpack/package.json').version.split('.')[0] === '2') {
+if (Number(require('webpack/package.json').version.split('.')[0]) > 1) {
module.exports.auto = module.exports.dependency;
}
diff --git a/node_modules/html-webpack-plugin/lib/loader.js b/node_modules/html-webpack-plugin/lib/loader.js
index e1af5e513..6b8bd0d8e 100644
--- a/node_modules/html-webpack-plugin/lib/loader.js
+++ b/node_modules/html-webpack-plugin/lib/loader.js
@@ -17,7 +17,7 @@ module.exports = function (source) {
return source;
}
// Skip .js files
- if (/\.js$/.test(this.request)) {
+ if (/\.js$/.test(this.resourcePath)) {
return source;
}
diff --git a/node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE b/node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE
new file mode 100644
index 000000000..c4bdf1b81
--- /dev/null
+++ b/node_modules/html-webpack-plugin/node_modules/loader-utils/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2012 - 2015 Tobias Koppers
+
+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.
diff --git a/node_modules/html-webpack-plugin/node_modules/loader-utils/README.md b/node_modules/html-webpack-plugin/node_modules/loader-utils/README.md
new file mode 100644
index 000000000..305fa9029
--- /dev/null
+++ b/node_modules/html-webpack-plugin/node_modules/loader-utils/README.md
@@ -0,0 +1,217 @@
+# loader-utils
+
+## Methods
+
+### `getLoaderConfig`
+
+Recommended way to retrieve the loader config:
+
+```javascript
+// inside your loader
+config = loaderUtils.getLoaderConfig(this, "myLoader");
+```
+
+Tries to read the loader config from the `webpack.config.js` under the given property name (`"myLoader"` in this case) and merges the result with the loader query. For example, if your `webpack.config.js` had this property...
+
+```javascript
+cheesecakeLoader: {
+ type: "delicious",
+ slices: 4
+}
+```
+
+...and your loader was called with `?slices=8`, `getLoaderConfig(this, "cheesecakeLoader")` would return
+
+```javascript
+{
+ type: "delicious",
+ slices: 8
+}
+```
+
+It is recommended that you use the camelCased loader name as your default config property name.
+
+### `parseQuery`
+
+``` javascript
+var query = loaderUtils.parseQuery(this.query);
+assert(typeof query == "object");
+if(query.flag)
+ // ...
+```
+
+``` text
+null -> {}
+? -> {}
+?flag -> { flag: true }
+?+flag -> { flag: true }
+?-flag -> { flag: false }
+?xyz=test -> { xyz: "test" }
+?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" }
+?{json:5,data:{a:1}} -> { json: 5, data: { a: 1 } }
+```
+
+### `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.
+
+```javascript
+var url = "path/to/module.js";
+var 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
+var url = "~path/to/module.js";
+var 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
+var url = "/path/to/module.js";
+var root = "./root";
+var 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
+var url = "/path/to/module.js";
+var root = "~";
+var 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
+var 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 of the resource is in.
+* `[emoji]` a random emoji representation of `options.content`
+* `[emoji:<length>]` same as above, but with a customizable number of emojis
+* `[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`
+
+Examples
+
+``` javascript
+// loaderContext.resourcePath = "/app/js/javascript.js"
+loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext]", { content: ... });
+// => js/9473fdd0d880a43c21b7778d34872157.script.js
+
+// loaderContext.resourcePath = "/app/page.html"
+loaderUtils.interpolateName(loaderContext, "html-[hash:6].html", { content: ... });
+// => html-9473fd.html
+
+// loaderContext.resourcePath = "/app/flash.txt"
+loaderUtils.interpolateName(loaderContext, "[hash]", { content: ... });
+// => c31e9820c001c9c4a86bce33ce43b679
+
+// loaderContext.resourcePath = "/app/img/image.gif"
+loaderUtils.interpolateName(loaderContext, "[emoji]", { content: ... });
+// => ๐Ÿ‘
+
+// loaderContext.resourcePath = "/app/img/image.gif"
+loaderUtils.interpolateName(loaderContext, "[emoji:4]", { content: ... });
+// => ๐Ÿ™๐Ÿข๐Ÿ“ค๐Ÿ
+
+// loaderContext.resourcePath = "/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 = "/app/img/myself.png"
+// loaderContext.query.name =
+loaderUtils.interpolateName(loaderContext, "picture.png");
+// => picture.png
+
+// loaderContext.resourcePath = "/app/dir/file.png"
+loaderUtils.interpolateName(loaderContext, "[path][name].[ext]?[hash]", { content: ... });
+// => /app/dir/file.png?9473fdd0d880a43c21b7778d34872157
+
+// loaderContext.resourcePath = "/app/js/page-home.js"
+loaderUtils.interpolateName(loaderContext, "script-[1].[ext]", { regExp: "page-(.*)\\.js", content: ... });
+// => script-home.js
+```
+
+### `getHashDigest`
+
+``` javascript
+var 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)
diff --git a/node_modules/html-webpack-plugin/node_modules/loader-utils/index.js b/node_modules/html-webpack-plugin/node_modules/loader-utils/index.js
new file mode 100644
index 000000000..49e1d18f7
--- /dev/null
+++ b/node_modules/html-webpack-plugin/node_modules/loader-utils/index.js
@@ -0,0 +1,331 @@
+var JSON5 = require("json5");
+var path = require("path");
+var util = require("util");
+var os = require("os");
+var assign = require("object-assign");
+var emojiRegex = /[\uD800-\uDFFF]./;
+var emojiList = require("emojis-list").filter(function(emoji) {
+ return emojiRegex.test(emoji)
+});
+var matchAbsolutePath = /^\/|^[A-Z]:[/\\]|^\\\\/i; // node 0.10 does not support path.isAbsolute()
+var matchAbsoluteWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
+var matchRelativePath = /^\.\.?[/\\]/;
+
+var baseEncodeTables = {
+ 26: "abcdefghijklmnopqrstuvwxyz",
+ 32: "123456789abcdefghjkmnpqrstuvwxyz", // no 0lio
+ 36: "0123456789abcdefghijklmnopqrstuvwxyz",
+ 49: "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no lIO
+ 52: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ 58: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no 0lIO
+ 62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ 64: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"
+};
+var emojiCache = {};
+var parseQueryDeprecationWarning = util.deprecate(function() {},
+ "loaderUtils.parseQuery() received a non-string value which can be problematic, " +
+ "see https://github.com/webpack/loader-utils/issues/56" + os.EOL +
+ "parseQuery() will be replaced with getOptions() in the next major version of loader-utils."
+);
+
+function encodeStringToEmoji(content, length) {
+ if (emojiCache[content]) return emojiCache[content];
+ length = length || 1;
+ var emojis = [];
+ do {
+ var index = Math.floor(Math.random() * emojiList.length);
+ emojis.push(emojiList[index]);
+ emojiList.splice(index, 1);
+ } while (--length > 0);
+ var emojiEncoding = emojis.join('');
+ emojiCache[content] = emojiEncoding;
+ return emojiEncoding;
+}
+
+function encodeBufferToBase(buffer, base) {
+ var encodeTable = baseEncodeTables[base];
+ if (!encodeTable) throw new Error("Unknown encoding base" + base);
+
+ var readLength = buffer.length;
+
+ var Big = require('big.js');
+ Big.RM = Big.DP = 0;
+ var b = new Big(0);
+ for (var i = readLength - 1; i >= 0; i--) {
+ b = b.times(256).plus(buffer[i]);
+ }
+
+ var output = "";
+ while (b.gt(0)) {
+ output = encodeTable[b.mod(base)] + output;
+ b = b.div(base);
+ }
+
+ Big.DP = 20;
+ Big.RM = 1;
+
+ return output;
+}
+
+exports.parseQuery = function parseQuery(query) {
+ var specialValues = {
+ 'null': null,
+ 'true': true,
+ 'false': false
+ };
+ if(!query) return {};
+ if(typeof query !== "string") {
+ parseQueryDeprecationWarning();
+ return query;
+ }
+ if(query.substr(0, 1) !== "?")
+ throw new Error("a valid query string passed to parseQuery should begin with '?'");
+ query = query.substr(1);
+ var queryLength = query.length;
+ if(query.substr(0, 1) === "{" && query.substr(-1) === "}") {
+ return JSON5.parse(query);
+ }
+ var queryArgs = query.split(/[,\&]/g);
+ var result = {};
+ queryArgs.forEach(function(arg) {
+ var idx = arg.indexOf("=");
+ if(idx >= 0) {
+ var name = arg.substr(0, idx);
+ var 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;
+};
+
+exports.getLoaderConfig = function(loaderContext, defaultConfigKey) {
+ var query = exports.parseQuery(loaderContext.query);
+ var configKey = query.config || defaultConfigKey;
+ if (configKey) {
+ var config = loaderContext.options[configKey] || {};
+ delete query.config;
+ return assign({}, config, query);
+ }
+
+ return query;
+};
+
+exports.stringifyRequest = function(loaderContext, request) {
+ var splitted = request.split("!");
+ var context = loaderContext.context || (loaderContext.options && loaderContext.options.context);
+ return JSON.stringify(splitted.map(function(part) {
+ // First, separate singlePath from query, because the query might contain paths again
+ var splittedPart = part.match(/^(.*?)(\?.*)/);
+ var singlePath = splittedPart ? splittedPart[1] : part;
+ var query = splittedPart ? splittedPart[2] : "";
+ if(matchAbsolutePath.test(singlePath) && context) {
+ singlePath = path.relative(context, singlePath);
+ if(matchAbsolutePath.test(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(matchRelativePath.test(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("!"));
+};
+
+function dotRequest(obj) {
+ return obj.request;
+}
+
+exports.getRemainingRequest = function(loaderContext) {
+ if(loaderContext.remainingRequest)
+ return loaderContext.remainingRequest;
+ var request = loaderContext.loaders.slice(loaderContext.loaderIndex+1).map(dotRequest).concat([loaderContext.resource]);
+ return request.join("!");
+};
+
+exports.getCurrentRequest = function(loaderContext) {
+ if(loaderContext.currentRequest)
+ return loaderContext.currentRequest;
+ var request = loaderContext.loaders.slice(loaderContext.loaderIndex).map(dotRequest).concat([loaderContext.resource]);
+ return request.join("!");
+};
+
+exports.isUrlRequest = function(url, root) {
+ // An URL is not an request if
+ // 1. it's a Data Url
+ // 2. it's an absolute url or and protocol-relative
+ // 3. it's some kind of url for a template
+ if(/^data:|^chrome-extension:|^(https?:)?\/\/|^[\{\}\[\]#*;,'ยง\$%&\(=?`ยด\^ยฐ<>]/.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;
+};
+
+exports.urlToRequest = function(url, root) {
+ var moduleRequestRegex = /^[^?]*~/;
+ var request;
+
+ if(matchAbsoluteWin32Path.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;
+};
+
+exports.parseString = function parseString(str) {
+ try {
+ if(str[0] === '"') return JSON.parse(str);
+ if(str[0] === "'" && str.substr(str.length - 1) === "'") {
+ return parseString(str.replace(/\\.|"/g, function(x) {
+ if(x === '"') return '\\"';
+ return x;
+ }).replace(/^'|'$/g, '"'));
+ }
+ return JSON.parse('"' + str + '"');
+ } catch(e) {
+ return str;
+ }
+};
+
+exports.getHashDigest = function getHashDigest(buffer, hashType, digestType, maxLength) {
+ hashType = hashType || "md5";
+ maxLength = maxLength || 9999;
+ var 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);
+ }
+};
+
+exports.interpolateName = function interpolateName(loaderContext, name, options) {
+ var filename;
+ if (typeof name === "function") {
+ filename = name(loaderContext.resourcePath);
+ } else {
+ filename = name || "[hash].[ext]";
+ }
+ var context = options.context;
+ var content = options.content;
+ var regExp = options.regExp;
+ var ext = "bin";
+ var basename = "file";
+ var directory = "";
+ var folder = "";
+ if(loaderContext.resourcePath) {
+ var resourcePath = loaderContext.resourcePath;
+ var idx = resourcePath.lastIndexOf(".");
+ var i = resourcePath.lastIndexOf("\\");
+ var j = resourcePath.lastIndexOf("/");
+ var p = i < 0 ? j : j < 0 ? i : i < j ? i : j;
+ if(idx >= 0) {
+ ext = resourcePath.substr(idx+1);
+ resourcePath = resourcePath.substr(0, idx);
+ }
+ if(p >= 0) {
+ basename = resourcePath.substr(p+1);
+ resourcePath = resourcePath.substr(0, p+1);
+ }
+ 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);
+ }
+ }
+ var url = filename;
+ if(content) {
+ // Match hash template
+ url = url.replace(/\[(?:(\w+):)?hash(?::([a-z]+\d*))?(?::(\d+))?\]/ig, function() {
+ return exports.getHashDigest(content, arguments[1], arguments[2], parseInt(arguments[3], 10));
+ }).replace(/\[emoji(?::(\d+))?\]/ig, function() {
+ return encodeStringToEmoji(content, arguments[1]);
+ });
+ }
+ url = url.replace(/\[ext\]/ig, function() {
+ return ext;
+ }).replace(/\[name\]/ig, function() {
+ return basename;
+ }).replace(/\[path\]/ig, function() {
+ return directory;
+ }).replace(/\[folder\]/ig, function() {
+ return folder;
+ });
+ if(regExp && loaderContext.resourcePath) {
+ var re = new RegExp(regExp);
+ var match = loaderContext.resourcePath.match(re);
+ if(match) {
+ for (var i = 0; i < match.length; i++) {
+ var re = new RegExp("\\[" + i + "\\]", "ig");
+ url = url.replace(re, match[i]);
+ }
+ }
+ }
+ if(typeof loaderContext.options === "object" && typeof loaderContext.options.customInterpolateName === "function") {
+ url = loaderContext.options.customInterpolateName.call(loaderContext, url, name, options);
+ }
+ return url;
+};
diff --git a/node_modules/html-webpack-plugin/node_modules/loader-utils/node_modules/.bin/json5 b/node_modules/html-webpack-plugin/node_modules/loader-utils/node_modules/.bin/json5
new file mode 120000
index 000000000..09cacab1f
--- /dev/null
+++ b/node_modules/html-webpack-plugin/node_modules/loader-utils/node_modules/.bin/json5
@@ -0,0 +1 @@
+../../../../../json5/lib/cli.js \ No newline at end of file
diff --git a/node_modules/html-webpack-plugin/node_modules/loader-utils/package.json b/node_modules/html-webpack-plugin/node_modules/loader-utils/package.json
new file mode 100644
index 000000000..699cb0282
--- /dev/null
+++ b/node_modules/html-webpack-plugin/node_modules/loader-utils/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "loader-utils",
+ "version": "0.2.17",
+ "author": "Tobias Koppers @sokra",
+ "description": "utils for webpack loaders",
+ "dependencies": {
+ "big.js": "^3.1.3",
+ "emojis-list": "^2.0.0",
+ "json5": "^0.5.0",
+ "object-assign": "^4.0.1"
+ },
+ "scripts": {
+ "test": "mocha",
+ "travis": "npm run cover -- --report lcovonly",
+ "cover": "istanbul cover -x *.runtime.js node_modules/mocha/bin/_mocha",
+ "publish-patch": "mocha && npm version patch && git push && git push --tags && npm publish"
+ },
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/webpack/loader-utils.git"
+ },
+ "devDependencies": {
+ "coveralls": "^2.11.2",
+ "istanbul": "^0.3.14",
+ "mocha": "^1.21.4"
+ },
+ "files": [
+ "index.js"
+ ]
+}
diff --git a/node_modules/html-webpack-plugin/package.json b/node_modules/html-webpack-plugin/package.json
index f6c5b41a5..81b45289e 100644
--- a/node_modules/html-webpack-plugin/package.json
+++ b/node_modules/html-webpack-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "html-webpack-plugin",
- "version": "2.28.0",
+ "version": "2.30.1",
"description": "Simplifies creation of HTML files to serve your webpack bundles",
"main": "index.js",
"files": [
@@ -16,7 +16,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/ampedandwired/html-webpack-plugin.git"
+ "url": "https://github.com/jantimon/html-webpack-plugin.git"
},
"keywords": [
"webpack",
@@ -27,9 +27,9 @@
"author": "Charles Blaxland <charles.blaxland@gmail.com> (https://github.com/ampedandwired)",
"license": "MIT",
"bugs": {
- "url": "https://github.com/ampedandwired/html-webpack-plugin/issues"
+ "url": "https://github.com/jantimon/html-webpack-plugin/issues"
},
- "homepage": "https://github.com/ampedandwired/html-webpack-plugin",
+ "homepage": "https://github.com/jantimon/html-webpack-plugin",
"semistandard": {
"ignore": [
"examples/*/dist/**/*.*"
@@ -63,6 +63,6 @@
"toposort": "^1.0.0"
},
"peerDependencies": {
- "webpack": "1 || ^2 || ^2.1.0-beta || ^2.2.0-rc"
+ "webpack": "1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3"
}
}