first commit

This commit is contained in:
DanielRamirezGe
2020-01-14 20:43:08 -06:00
parent 3557894f7f
commit 5eecfbf6cd
26326 changed files with 2434803 additions and 0 deletions
+115
View File
@@ -0,0 +1,115 @@
# Changelog
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.
## [0.8.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.7.0...v0.8.0) (2019-07-16)
### Features
* Add ignoreOrder option ([#422](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/422)) ([4ad3373](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/4ad3373))
## [0.7.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.6.0...v0.7.0) (2019-05-27)
### Bug Fixes
* do not attempt to reload unrequestable urls ([#378](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/378)) ([44d00ea](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/44d00ea))
* fix `publicPath` regression ([#384](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/384)) ([582ebfe](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/582ebfe))
* enable using plugin without defining options ([#393](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/393)) ([a7dee8c](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/a7dee8c))
* downgrading normalize-url ([#399](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/399)) ([0dafaf6](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/0dafaf6))
* hmr do not crash on link without href ([#400](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/400)) ([aa9b541](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/aa9b541))
* hmr reload with invalid link url ([#402](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/402)) ([30a19b0](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/30a19b0))
### Features
* add `moduleFilename` option ([#381](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/381)) ([13e9cbf](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/13e9cbf))
<a name="0.6.0"></a>
# [0.6.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.5.0...v0.6.0) (2019-04-10)
### Features
* added error code to chunk load Error ([#347](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/347)) ([b653641](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/b653641))
* adding hot module reloading ([#334](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/334)) ([4ed9c5a](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/4ed9c5a))
* publicPath can be a function ([#373](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/373)) ([7b1425a](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/7b1425a))
<a name="0.5.0"></a>
# [0.5.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.5...v0.5.0) (2018-12-07)
### Features
* add crossOriginLoading option support ([#313](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/313)) ([ffb0d87](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/ffb0d87))
<a name="0.4.5"></a>
## [0.4.5](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.4...v0.4.5) (2018-11-21)
### Bug Fixes
* **index:** allow requesting failed async css files ([#292](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/292)) ([2eb0af5](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/2eb0af5))
<a name="0.4.4"></a>
## [0.4.4](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.3...v0.4.4) (2018-10-10)
### Bug Fixes
* **index:** assign empty `module.id` to prevent `contenthash` from changing unnecessarily ([#284](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/284)) ([d7946d0](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/d7946d0))
<a name="0.4.3"></a>
## [0.4.3](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.2...v0.4.3) (2018-09-18)
### Bug Fixes
* **loader:** pass `emitFile` to the child compilation (`loaderContext.emitFile`) ([#177](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/177)) ([18c066e](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/18c066e))
<a name="0.4.2"></a>
## [0.4.2](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.0...v0.4.2) (2018-08-21)
### Bug Fixes
* use correct order when multiple chunk groups are merged ([#246](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/246)) ([c3b363d](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/c3b363d))
<a name="0.4.1"></a>
## [0.4.1](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.4.0...v0.4.1) (2018-06-29)
### Bug Fixes
* CSS ordering with multiple entry points ([#130](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/130)) ([79373eb](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/79373eb))
# 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.
x.x.x / <year>-<month>-<day>
==================
* Bug fix -
* Feature -
* Chore -
* Docs -
+20
View 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.
+394
View File
@@ -0,0 +1,394 @@
<div align="center">
<!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
<img width="200" height="200" src="https://cdn.worldvectorlogo.com/logos/javascript.svg">
<a href="https://webpack.js.org/">
<img width="200" height="200" vspace="" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
</a>
<h1>mini-css-extract-plugin</h1>
</div>
[![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
This plugin extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS and SourceMaps.
It builds on top of a new webpack v4 feature (module types) and requires webpack 4 to work.
Compared to the extract-text-webpack-plugin:
- Async loading
- No duplicate compilation (performance)
- Easier to use
- Specific to CSS
<h2 align="center">Install</h2>
```bash
npm install --save-dev mini-css-extract-plugin
```
<h2 align="center">Usage</h2>
### Configuration
#### `publicPath`
Type: `String|Function`
Default: the `publicPath` in `webpackOptions.output`
Specifies a custom public path for the target file(s).
#### Minimal example
**webpack.config.js**
```js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// all options are optional
filename: '[name].css',
chunkFilename: '[id].css',
ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it uses publicPath in webpackOptions.output
publicPath: '../',
hmr: process.env.NODE_ENV === 'development',
},
},
'css-loader',
],
},
],
},
};
```
#### `publicPath` function example
**webpack.config.js**
```js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: (resourcePath, context) => {
// publicPath is the relative path of the resource to the context
// e.g. for ./css/admin/main.css the publicPath will be ../../
// while for ./css/main.css the publicPath will be ../
return path.relative(path.dirname(resourcePath), context) + '/';
},
},
},
'css-loader',
],
},
],
},
};
```
#### Advanced configuration example
This plugin should be used only on `production` builds without `style-loader` in the loaders chain, especially if you want to have HMR in `development`.
Here is an example to have both HMR in `development` and your styles extracted in a file for `production` builds.
(Loaders options left out for clarity, adapt accordingly to your needs.)
**webpack.config.js**
```js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const devMode = process.env.NODE_ENV !== 'production';
module.exports = {
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: devMode ? '[name].css' : '[name].[hash].css',
chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
}),
],
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
hmr: process.env.NODE_ENV === 'development',
},
},
'css-loader',
'postcss-loader',
'sass-loader',
],
},
],
},
};
```
#### Hot Module Reloading (HMR)
extract-mini-css-plugin supports hot reloading of actual css files in development. Some options are provided to enable HMR of both standard stylesheets and locally scoped CSS or CSS modules. Below is an example configuration of mini-css for HMR use with CSS modules.
While we attempt to hmr css-modules. It is not easy to perform when code-splitting with custom chunk names. `reloadAll` is an option that should only be enabled if HMR isn't working correctly. The core challenge with css-modules is that when code-split, the chunk ids can and do end up different compared to the filename.
**webpack.config.js**
```js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
// only enable hot in development
hmr: process.env.NODE_ENV === 'development',
// if hmr does not work, this is a forceful method.
reloadAll: true,
},
},
'css-loader',
],
},
],
},
};
```
### Minimizing For Production
To minify the output, use a plugin like [optimize-css-assets-webpack-plugin](https://github.com/NMFR/optimize-css-assets-webpack-plugin). Setting `optimization.minimizer` overrides the defaults provided by webpack, so make sure to also specify a JS minimizer:
**webpack.config.js**
```js
const TerserJSPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = {
optimization: {
minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
};
```
### Features
#### Using preloaded or inlined CSS
The runtime code detects already added CSS via `<link>` or `<style>` tag.
This can be useful when injecting CSS on server-side for Server-Side-Rendering.
The `href` of the `<link>` tag has to match the URL that will be used for loading the CSS chunk.
The `data-href` attribute can be used for `<link>` and `<style>` too.
When inlining CSS `data-href` must be used.
#### Extracting all CSS in a single file
Similar to what [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) does, the CSS
can be extracted in one CSS file using `optimization.splitChunks.cacheGroups`.
**webpack.config.js**
```js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
optimization: {
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
},
},
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
};
```
#### Extracting CSS based on entry
You may also extract the CSS based on the webpack entry name. This is especially useful if you import routes dynamically
but want to keep your CSS bundled according to entry. This also prevents the CSS duplication issue one had with the
ExtractTextPlugin.
```javascript
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
function recursiveIssuer(m) {
if (m.issuer) {
return recursiveIssuer(m.issuer);
} else if (m.name) {
return m.name;
} else {
return false;
}
}
module.exports = {
entry: {
foo: path.resolve(__dirname, 'src/foo'),
bar: path.resolve(__dirname, 'src/bar'),
},
optimization: {
splitChunks: {
cacheGroups: {
fooStyles: {
name: 'foo',
test: (m, c, entry = 'foo') =>
m.constructor.name === 'CssModule' && recursiveIssuer(m) === entry,
chunks: 'all',
enforce: true,
},
barStyles: {
name: 'bar',
test: (m, c, entry = 'bar') =>
m.constructor.name === 'CssModule' && recursiveIssuer(m) === entry,
chunks: 'all',
enforce: true,
},
},
},
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
};
```
#### Module Filename Option
With the `moduleFilename` option you can use chunk data to customize the filename. This is particularly useful when dealing with multiple entry points and wanting to get more control out of the filename for a given entry point/chunk. In the example below, we'll use `moduleFilename` to output the generated css into a different directory.
```javascript
const miniCssExtractPlugin = new MiniCssExtractPlugin({
moduleFilename: ({ name }) => `${name.replace('/js/', '/css/')}.css`,
});
```
#### Long Term Caching
For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`.
### Remove Order Warnings
For projects where css ordering has been mitigated through consistent use of scoping or naming conventions, the css order warnings can be disabled by setting the ignoreOrder flag to true for the plugin.
```javascript
new MiniCssExtractPlugin({
ignoreOrder: true,
}),
```
### Media Query Plugin
If you'd like to extract the media queries from the extracted CSS (so mobile users don't need to load desktop or tablet specific CSS anymore) you should use one of the following plugins:
- [Media Query Plugin](https://github.com/SassNinja/media-query-plugin)
- [Media Query Splitting Plugin](https://github.com/mike-diamond/media-query-splitting-plugin)
## License
[MIT](./LICENSE)
[npm]: https://img.shields.io/npm/v/mini-css-extract-plugin.svg
[npm-url]: https://npmjs.com/package/mini-css-extract-plugin
[node]: https://img.shields.io/node/v/mini-css-extract-plugin.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack-contrib/mini-css-extract-plugin.svg
[deps-url]: https://david-dm.org/webpack-contrib/mini-css-extract-plugin
[tests]: https://dev.azure.com/webpack-contrib/mini-css-extract-plugin/_apis/build/status/webpack-contrib.mini-css-extract-plugin?branchName=master
[tests-url]: https://dev.azure.com/webpack-contrib/mini-css-extract-plugin/_build/latest?definitionId=6&branchName=master
[cover]: https://codecov.io/gh/webpack-contrib/mini-css-extract-plugin/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/mini-css-extract-plugin
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack
[size]: https://packagephobia.now.sh/badge?p=mini-css-extract-plugin
[size-url]: https://packagephobia.now.sh/result?p=mini-css-extract-plugin
+3
View File
@@ -0,0 +1,3 @@
"use strict";
module.exports = require('./index').default;
+211
View File
@@ -0,0 +1,211 @@
"use strict";
/* eslint-env browser */
/*
eslint-disable
no-console,
func-names
*/
var normalizeUrl = require('normalize-url');
var srcByModuleId = Object.create(null);
var noDocument = typeof document === 'undefined';
var forEach = Array.prototype.forEach;
function debounce(fn, time) {
var timeout = 0;
return function () {
var self = this; // eslint-disable-next-line prefer-rest-params
var args = arguments;
var functionCall = function functionCall() {
return fn.apply(self, args);
};
clearTimeout(timeout);
timeout = setTimeout(functionCall, time);
};
}
function noop() {}
function getCurrentScriptUrl(moduleId) {
var src = srcByModuleId[moduleId];
if (!src) {
if (document.currentScript) {
src = document.currentScript.src;
} else {
var scripts = document.getElementsByTagName('script');
var lastScriptTag = scripts[scripts.length - 1];
if (lastScriptTag) {
src = lastScriptTag.src;
}
}
srcByModuleId[moduleId] = src;
}
return function (fileMap) {
if (!src) {
return null;
}
var splitResult = src.split(/([^\\/]+)\.js$/);
var filename = splitResult && splitResult[1];
if (!filename) {
return [src.replace('.js', '.css')];
}
if (!fileMap) {
return [src.replace('.js', '.css')];
}
return fileMap.split(',').map(function (mapRule) {
var reg = new RegExp("".concat(filename, "\\.js$"), 'g');
return normalizeUrl(src.replace(reg, "".concat(mapRule.replace(/{fileName}/g, filename), ".css")), {
stripWWW: false
});
});
};
}
function updateCss(el, url) {
if (!url) {
if (!el.href) {
return;
} // eslint-disable-next-line
url = el.href.split('?')[0];
}
if (!isUrlRequest(url)) {
return;
}
if (el.isLoaded === false) {
// We seem to be about to replace a css link that hasn't loaded yet.
// We're probably changing the same file more than once.
return;
}
if (!url || !(url.indexOf('.css') > -1)) {
return;
} // eslint-disable-next-line no-param-reassign
el.visited = true;
var newEl = el.cloneNode();
newEl.isLoaded = false;
newEl.addEventListener('load', function () {
newEl.isLoaded = true;
el.parentNode.removeChild(el);
});
newEl.addEventListener('error', function () {
newEl.isLoaded = true;
el.parentNode.removeChild(el);
});
newEl.href = "".concat(url, "?").concat(Date.now());
if (el.nextSibling) {
el.parentNode.insertBefore(newEl, el.nextSibling);
} else {
el.parentNode.appendChild(newEl);
}
}
function getReloadUrl(href, src) {
var ret; // eslint-disable-next-line no-param-reassign
href = normalizeUrl(href, {
stripWWW: false
}); // eslint-disable-next-line array-callback-return
src.some(function (url) {
if (href.indexOf(src) > -1) {
ret = url;
}
});
return ret;
}
function reloadStyle(src) {
var elements = document.querySelectorAll('link');
var loaded = false;
forEach.call(elements, function (el) {
if (!el.href) {
return;
}
var url = getReloadUrl(el.href, src);
if (!isUrlRequest(url)) {
return;
}
if (el.visited === true) {
return;
}
if (url) {
updateCss(el, url);
loaded = true;
}
});
return loaded;
}
function reloadAll() {
var elements = document.querySelectorAll('link');
forEach.call(elements, function (el) {
if (el.visited === true) {
return;
}
updateCss(el);
});
}
function isUrlRequest(url) {
// An URL is not an request if
// It is not http or https
if (!/^https?:/i.test(url)) {
return false;
}
return true;
}
module.exports = function (moduleId, options) {
if (noDocument) {
console.log('no window.document found, will not HMR CSS');
return noop;
}
var getScriptSrc = getCurrentScriptUrl(moduleId);
function update() {
var src = getScriptSrc(options.filename);
var reloaded = reloadStyle(src);
if (options.locals) {
console.log('[HMR] Detected local css modules. Reload all css');
reloadAll();
return;
}
if (reloaded && !options.reloadAll) {
console.log('[HMR] css reload %s', src.join(' '));
} else {
console.log('[HMR] Reload all css');
reloadAll();
}
}
return debounce(update, 50);
};
+469
View File
@@ -0,0 +1,469 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _webpack = _interopRequireDefault(require("webpack"));
var _webpackSources = _interopRequireDefault(require("webpack-sources"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable class-methods-use-this */
const {
ConcatSource,
SourceMapSource,
OriginalSource
} = _webpackSources.default;
const {
Template,
util: {
createHash
}
} = _webpack.default;
const MODULE_TYPE = 'css/mini-extract';
const pluginName = 'mini-css-extract-plugin';
const REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/i;
const REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/i;
const REGEXP_NAME = /\[name\]/i;
const REGEXP_PLACEHOLDERS = /\[(name|id|chunkhash)\]/g;
const DEFAULT_FILENAME = '[name].css';
class CssDependency extends _webpack.default.Dependency {
constructor({
identifier,
content,
media,
sourceMap
}, context, identifierIndex) {
super();
this.identifier = identifier;
this.identifierIndex = identifierIndex;
this.content = content;
this.media = media;
this.sourceMap = sourceMap;
this.context = context;
}
getResourceIdentifier() {
return `css-module-${this.identifier}-${this.identifierIndex}`;
}
}
class CssDependencyTemplate {
apply() {}
}
class CssModule extends _webpack.default.Module {
constructor(dependency) {
super(MODULE_TYPE, dependency.context);
this.id = '';
this._identifier = dependency.identifier;
this._identifierIndex = dependency.identifierIndex;
this.content = dependency.content;
this.media = dependency.media;
this.sourceMap = dependency.sourceMap;
} // no source() so webpack doesn't do add stuff to the bundle
size() {
return this.content.length;
}
identifier() {
return `css ${this._identifier} ${this._identifierIndex}`;
}
readableIdentifier(requestShortener) {
return `css ${requestShortener.shorten(this._identifier)}${this._identifierIndex ? ` (${this._identifierIndex})` : ''}`;
}
nameForCondition() {
const resource = this._identifier.split('!').pop();
const idx = resource.indexOf('?');
if (idx >= 0) {
return resource.substring(0, idx);
}
return resource;
}
updateCacheModule(module) {
this.content = module.content;
this.media = module.media;
this.sourceMap = module.sourceMap;
}
needRebuild() {
return true;
}
build(options, compilation, resolver, fileSystem, callback) {
this.buildInfo = {};
this.buildMeta = {};
callback();
}
updateHash(hash) {
super.updateHash(hash);
hash.update(this.content);
hash.update(this.media || '');
hash.update(this.sourceMap ? JSON.stringify(this.sourceMap) : '');
}
}
class CssModuleFactory {
create({
dependencies: [dependency]
}, callback) {
callback(null, new CssModule(dependency));
}
}
class MiniCssExtractPlugin {
constructor(options = {}) {
this.options = Object.assign({
filename: DEFAULT_FILENAME,
moduleFilename: () => options.filename || DEFAULT_FILENAME,
ignoreOrder: false
}, options);
if (!this.options.chunkFilename) {
const {
filename
} = this.options; // Anything changing depending on chunk is fine
if (filename.match(REGEXP_PLACEHOLDERS)) {
this.options.chunkFilename = filename;
} else {
// Elsewise prefix '[id].' in front of the basename to make it changing
this.options.chunkFilename = filename.replace(/(^|\/)([^/]*(?:\?|$))/, '$1[id].$2');
}
}
}
apply(compiler) {
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
compilation.hooks.normalModuleLoader.tap(pluginName, (lc, m) => {
const loaderContext = lc;
const module = m;
loaderContext[MODULE_TYPE] = content => {
if (!Array.isArray(content) && content != null) {
throw new Error(`Exported value was not extracted as an array: ${JSON.stringify(content)}`);
}
const identifierCountMap = new Map();
for (const line of content) {
const count = identifierCountMap.get(line.identifier) || 0;
module.addDependency(new CssDependency(line, m.context, count));
identifierCountMap.set(line.identifier, count + 1);
}
};
});
compilation.dependencyFactories.set(CssDependency, new CssModuleFactory());
compilation.dependencyTemplates.set(CssDependency, new CssDependencyTemplate());
compilation.mainTemplate.hooks.renderManifest.tap(pluginName, (result, {
chunk
}) => {
const renderedModules = Array.from(chunk.modulesIterable).filter(module => module.type === MODULE_TYPE);
if (renderedModules.length > 0) {
result.push({
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
filenameTemplate: ({
chunk: chunkData
}) => this.options.moduleFilename(chunkData),
pathOptions: {
chunk,
contentHashType: MODULE_TYPE
},
identifier: `${pluginName}.${chunk.id}`,
hash: chunk.contentHash[MODULE_TYPE]
});
}
});
compilation.chunkTemplate.hooks.renderManifest.tap(pluginName, (result, {
chunk
}) => {
const renderedModules = Array.from(chunk.modulesIterable).filter(module => module.type === MODULE_TYPE);
if (renderedModules.length > 0) {
result.push({
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
filenameTemplate: this.options.chunkFilename,
pathOptions: {
chunk,
contentHashType: MODULE_TYPE
},
identifier: `${pluginName}.${chunk.id}`,
hash: chunk.contentHash[MODULE_TYPE]
});
}
});
compilation.mainTemplate.hooks.hashForChunk.tap(pluginName, (hash, chunk) => {
const {
chunkFilename
} = this.options;
if (REGEXP_CHUNKHASH.test(chunkFilename)) {
hash.update(JSON.stringify(chunk.getChunkMaps(true).hash));
}
if (REGEXP_CONTENTHASH.test(chunkFilename)) {
hash.update(JSON.stringify(chunk.getChunkMaps(true).contentHash[MODULE_TYPE] || {}));
}
if (REGEXP_NAME.test(chunkFilename)) {
hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
}
});
compilation.hooks.contentHash.tap(pluginName, chunk => {
const {
outputOptions
} = compilation;
const {
hashFunction,
hashDigest,
hashDigestLength
} = outputOptions;
const hash = createHash(hashFunction);
for (const m of chunk.modulesIterable) {
if (m.type === MODULE_TYPE) {
m.updateHash(hash);
}
}
const {
contentHash
} = chunk;
contentHash[MODULE_TYPE] = hash.digest(hashDigest).substring(0, hashDigestLength);
});
const {
mainTemplate
} = compilation;
mainTemplate.hooks.localVars.tap(pluginName, (source, chunk) => {
const chunkMap = this.getCssChunkObject(chunk);
if (Object.keys(chunkMap).length > 0) {
return Template.asString([source, '', '// object to store loaded CSS chunks', 'var installedCssChunks = {', Template.indent(chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(',\n')), '}']);
}
return source;
});
mainTemplate.hooks.requireEnsure.tap(pluginName, (source, chunk, hash) => {
const chunkMap = this.getCssChunkObject(chunk);
if (Object.keys(chunkMap).length > 0) {
const chunkMaps = chunk.getChunkMaps();
const {
crossOriginLoading
} = mainTemplate.outputOptions;
const linkHrefPath = mainTemplate.getAssetPath(JSON.stringify(this.options.chunkFilename), {
hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
hashWithLength: length => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
chunk: {
id: '" + chunkId + "',
hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
hashWithLength(length) {
const shortChunkHashMap = Object.create(null);
for (const chunkId of Object.keys(chunkMaps.hash)) {
if (typeof chunkMaps.hash[chunkId] === 'string') {
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substring(0, length);
}
}
return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
},
contentHash: {
[MODULE_TYPE]: `" + ${JSON.stringify(chunkMaps.contentHash[MODULE_TYPE])}[chunkId] + "`
},
contentHashWithLength: {
[MODULE_TYPE]: length => {
const shortContentHashMap = {};
const contentHash = chunkMaps.contentHash[MODULE_TYPE];
for (const chunkId of Object.keys(contentHash)) {
if (typeof contentHash[chunkId] === 'string') {
shortContentHashMap[chunkId] = contentHash[chunkId].substring(0, length);
}
}
return `" + ${JSON.stringify(shortContentHashMap)}[chunkId] + "`;
}
},
name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "`
},
contentHashType: MODULE_TYPE
});
return Template.asString([source, '', `// ${pluginName} CSS loading`, `var cssChunks = ${JSON.stringify(chunkMap)};`, 'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);', 'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {', Template.indent(['promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {', Template.indent([`var href = ${linkHrefPath};`, `var fullhref = ${mainTemplate.requireFn}.p + href;`, 'var existingLinkTags = document.getElementsByTagName("link");', 'for(var i = 0; i < existingLinkTags.length; i++) {', Template.indent(['var tag = existingLinkTags[i];', 'var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");', 'if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return resolve();']), '}', 'var existingStyleTags = document.getElementsByTagName("style");', 'for(var i = 0; i < existingStyleTags.length; i++) {', Template.indent(['var tag = existingStyleTags[i];', 'var dataHref = tag.getAttribute("data-href");', 'if(dataHref === href || dataHref === fullhref) return resolve();']), '}', 'var linkTag = document.createElement("link");', 'linkTag.rel = "stylesheet";', 'linkTag.type = "text/css";', 'linkTag.onload = resolve;', 'linkTag.onerror = function(event) {', Template.indent(['var request = event && event.target && event.target.src || fullhref;', 'var err = new Error("Loading CSS chunk " + chunkId + " failed.\\n(" + request + ")");', 'err.code = "CSS_CHUNK_LOAD_FAILED";', 'err.request = request;', 'delete installedCssChunks[chunkId]', 'linkTag.parentNode.removeChild(linkTag)', 'reject(err);']), '};', 'linkTag.href = fullhref;', crossOriginLoading ? Template.asString([`if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {`, Template.indent(`linkTag.crossOrigin = ${JSON.stringify(crossOriginLoading)};`), '}']) : '', 'var head = document.getElementsByTagName("head")[0];', 'head.appendChild(linkTag);']), '}).then(function() {', Template.indent(['installedCssChunks[chunkId] = 0;']), '}));']), '}']);
}
return source;
});
});
}
getCssChunkObject(mainChunk) {
const obj = {};
for (const chunk of mainChunk.getAllAsyncChunks()) {
for (const module of chunk.modulesIterable) {
if (module.type === MODULE_TYPE) {
obj[chunk.id] = 1;
break;
}
}
}
return obj;
}
renderContentAsset(compilation, chunk, modules, requestShortener) {
let usedModules;
const [chunkGroup] = chunk.groupsIterable;
if (typeof chunkGroup.getModuleIndex2 === 'function') {
// Store dependencies for modules
const moduleDependencies = new Map(modules.map(m => [m, new Set()])); // Get ordered list of modules per chunk group
// This loop also gathers dependencies from the ordered lists
// Lists are in reverse order to allow to use Array.pop()
const modulesByChunkGroup = Array.from(chunk.groupsIterable, cg => {
const sortedModules = modules.map(m => {
return {
module: m,
index: cg.getModuleIndex2(m)
};
}) // eslint-disable-next-line no-undefined
.filter(item => item.index !== undefined).sort((a, b) => b.index - a.index).map(item => item.module);
for (let i = 0; i < sortedModules.length; i++) {
const set = moduleDependencies.get(sortedModules[i]);
for (let j = i + 1; j < sortedModules.length; j++) {
set.add(sortedModules[j]);
}
}
return sortedModules;
}); // set with already included modules in correct order
usedModules = new Set();
const unusedModulesFilter = m => !usedModules.has(m);
while (usedModules.size < modules.length) {
let success = false;
let bestMatch;
let bestMatchDeps; // get first module where dependencies are fulfilled
for (const list of modulesByChunkGroup) {
// skip and remove already added modules
while (list.length > 0 && usedModules.has(list[list.length - 1])) {
list.pop();
} // skip empty lists
if (list.length !== 0) {
const module = list[list.length - 1];
const deps = moduleDependencies.get(module); // determine dependencies that are not yet included
const failedDeps = Array.from(deps).filter(unusedModulesFilter); // store best match for fallback behavior
if (!bestMatchDeps || bestMatchDeps.length > failedDeps.length) {
bestMatch = list;
bestMatchDeps = failedDeps;
}
if (failedDeps.length === 0) {
// use this module and remove it from list
usedModules.add(list.pop());
success = true;
break;
}
}
}
if (!success) {
// no module found => there is a conflict
// use list with fewest failed deps
// and emit a warning
const fallbackModule = bestMatch.pop();
if (!this.options.ignoreOrder) {
compilation.warnings.push(new Error(`chunk ${chunk.name || chunk.id} [${pluginName}]\n` + 'Conflicting order between:\n' + ` * ${fallbackModule.readableIdentifier(requestShortener)}\n` + `${bestMatchDeps.map(m => ` * ${m.readableIdentifier(requestShortener)}`).join('\n')}`));
}
usedModules.add(fallbackModule);
}
}
} else {
// fallback for older webpack versions
// (to avoid a breaking change)
// TODO remove this in next mayor version
// and increase minimum webpack version to 4.12.0
modules.sort((a, b) => a.index2 - b.index2);
usedModules = modules;
}
const source = new ConcatSource();
const externalsSource = new ConcatSource();
for (const m of usedModules) {
if (/^@import url/.test(m.content)) {
// HACK for IE
// http://stackoverflow.com/a/14676665/1458162
let {
content
} = m;
if (m.media) {
// insert media into the @import
// this is rar
// TODO improve this and parse the CSS to support multiple medias
content = content.replace(/;|\s*$/, m.media);
}
externalsSource.add(content);
externalsSource.add('\n');
} else {
if (m.media) {
source.add(`@media ${m.media} {\n`);
}
if (m.sourceMap) {
source.add(new SourceMapSource(m.content, m.readableIdentifier(requestShortener), m.sourceMap));
} else {
source.add(new OriginalSource(m.content, m.readableIdentifier(requestShortener)));
}
source.add('\n');
if (m.media) {
source.add('}\n');
}
}
}
return new ConcatSource(externalsSource, source);
}
}
MiniCssExtractPlugin.loader = require.resolve('./loader');
var _default = MiniCssExtractPlugin;
exports.default = _default;
+186
View File
@@ -0,0 +1,186 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pitch = pitch;
exports.default = _default;
var _module = _interopRequireDefault(require("module"));
var _path = _interopRequireDefault(require("path"));
var _loaderUtils = _interopRequireDefault(require("loader-utils"));
var _NodeTemplatePlugin = _interopRequireDefault(require("webpack/lib/node/NodeTemplatePlugin"));
var _NodeTargetPlugin = _interopRequireDefault(require("webpack/lib/node/NodeTargetPlugin"));
var _LibraryTemplatePlugin = _interopRequireDefault(require("webpack/lib/LibraryTemplatePlugin"));
var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
var _LimitChunkCountPlugin = _interopRequireDefault(require("webpack/lib/optimize/LimitChunkCountPlugin"));
var _schemaUtils = _interopRequireDefault(require("schema-utils"));
var _options = _interopRequireDefault(require("./options.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const MODULE_TYPE = 'css/mini-extract';
const pluginName = 'mini-css-extract-plugin';
function hotLoader(content, context) {
const accept = context.locals ? '' : 'module.hot.accept(undefined, cssReload);';
return `${content}
if(module.hot) {
// ${Date.now()}
var cssReload = require(${_loaderUtils.default.stringifyRequest(context.context, _path.default.join(__dirname, 'hmr/hotModuleReplacement.js'))})(module.id, ${JSON.stringify(_objectSpread({}, context.options, {
locals: !!context.locals
}))});
module.hot.dispose(cssReload);
${accept}
}
`;
}
const exec = (loaderContext, code, filename) => {
const module = new _module.default(filename, loaderContext);
module.paths = _module.default._nodeModulePaths(loaderContext.context); // eslint-disable-line no-underscore-dangle
module.filename = filename;
module._compile(code, filename); // eslint-disable-line no-underscore-dangle
return module.exports;
};
const findModuleById = (modules, id) => {
for (const module of modules) {
if (module.id === id) {
return module;
}
}
return null;
};
function pitch(request) {
const options = _loaderUtils.default.getOptions(this) || {};
(0, _schemaUtils.default)(_options.default, options, 'Mini CSS Extract Plugin Loader');
const loaders = this.loaders.slice(this.loaderIndex + 1);
this.addDependency(this.resourcePath);
const childFilename = '*'; // eslint-disable-line no-path-concat
const publicPath = typeof options.publicPath === 'string' ? options.publicPath === '' || options.publicPath.endsWith('/') ? options.publicPath : `${options.publicPath}/` : typeof options.publicPath === 'function' ? options.publicPath(this.resourcePath, this.rootContext) : this._compilation.outputOptions.publicPath;
const outputOptions = {
filename: childFilename,
publicPath
};
const childCompiler = this._compilation.createChildCompiler(`${pluginName} ${request}`, outputOptions);
new _NodeTemplatePlugin.default(outputOptions).apply(childCompiler);
new _LibraryTemplatePlugin.default(null, 'commonjs2').apply(childCompiler);
new _NodeTargetPlugin.default().apply(childCompiler);
new _SingleEntryPlugin.default(this.context, `!!${request}`, pluginName).apply(childCompiler);
new _LimitChunkCountPlugin.default({
maxChunks: 1
}).apply(childCompiler); // We set loaderContext[MODULE_TYPE] = false to indicate we already in
// a child compiler so we don't spawn another child compilers from there.
childCompiler.hooks.thisCompilation.tap(`${pluginName} loader`, compilation => {
compilation.hooks.normalModuleLoader.tap(`${pluginName} loader`, (loaderContext, module) => {
// eslint-disable-next-line no-param-reassign
loaderContext.emitFile = this.emitFile;
loaderContext[MODULE_TYPE] = false; // eslint-disable-line no-param-reassign
if (module.request === request) {
// eslint-disable-next-line no-param-reassign
module.loaders = loaders.map(loader => {
return {
loader: loader.path,
options: loader.options,
ident: loader.ident
};
});
}
});
});
let source;
childCompiler.hooks.afterCompile.tap(pluginName, compilation => {
source = compilation.assets[childFilename] && compilation.assets[childFilename].source(); // Remove all chunk assets
compilation.chunks.forEach(chunk => {
chunk.files.forEach(file => {
delete compilation.assets[file]; // eslint-disable-line no-param-reassign
});
});
});
const callback = this.async();
childCompiler.runAsChild((err, entries, compilation) => {
if (err) {
return callback(err);
}
if (compilation.errors.length > 0) {
return callback(compilation.errors[0]);
}
compilation.fileDependencies.forEach(dep => {
this.addDependency(dep);
}, this);
compilation.contextDependencies.forEach(dep => {
this.addContextDependency(dep);
}, this);
if (!source) {
return callback(new Error("Didn't get a result from child compiler"));
}
let text;
let locals;
try {
text = exec(this, source, request);
locals = text && text.locals;
if (!Array.isArray(text)) {
text = [[null, text]];
} else {
text = text.map(line => {
const module = findModuleById(compilation.modules, line[0]);
return {
identifier: module.identifier(),
content: line[1],
media: line[2],
sourceMap: line[3]
};
});
}
this[MODULE_TYPE](text);
} catch (e) {
return callback(e);
}
let resultSource = `// extracted by ${pluginName}`;
const result = locals ? `\nmodule.exports = ${JSON.stringify(locals)};` : '';
resultSource += options.hmr ? hotLoader(result, {
context: this.context,
options,
locals
}) : result;
return callback(null, resultSource);
});
}
function _default() {}
+19
View File
@@ -0,0 +1,19 @@
{
"additionalProperties": true,
"properties": {
"publicPath": {
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
]
}
},
"errorMessages": {
"publicPath": "should be {String} or {Function} (https://github.com/webpack-contrib/mini-css-extract-plugin#publicpath)"
},
"type": "object"
}
@@ -0,0 +1,161 @@
'use strict';
var url = require('url');
var punycode = require('punycode');
var queryString = require('query-string');
var prependHttp = require('prepend-http');
var sortKeys = require('sort-keys');
var objectAssign = require('object-assign');
var DEFAULT_PORTS = {
'http:': 80,
'https:': 443,
'ftp:': 21
};
// protocols that always contain a `//`` bit
var slashedProtocol = {
'http': true,
'https': true,
'ftp': true,
'gopher': true,
'file': true,
'http:': true,
'https:': true,
'ftp:': true,
'gopher:': true,
'file:': true
};
function testParameter(name, filters) {
return filters.some(function (filter) {
return filter instanceof RegExp ? filter.test(name) : filter === name;
});
}
module.exports = function (str, opts) {
opts = objectAssign({
normalizeProtocol: true,
normalizeHttps: false,
stripFragment: true,
stripWWW: true,
removeQueryParameters: [/^utm_\w+/i],
removeTrailingSlash: true,
removeDirectoryIndex: false
}, opts);
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
var hasRelativeProtocol = str.indexOf('//') === 0;
// prepend protocol
str = prependHttp(str.trim()).replace(/^\/\//, 'http://');
var urlObj = url.parse(str);
if (opts.normalizeHttps && urlObj.protocol === 'https:') {
urlObj.protocol = 'http:';
}
if (!urlObj.hostname && !urlObj.pathname) {
throw new Error('Invalid URL');
}
// prevent these from being used by `url.format`
delete urlObj.host;
delete urlObj.query;
// remove fragment
if (opts.stripFragment) {
delete urlObj.hash;
}
// remove default port
var port = DEFAULT_PORTS[urlObj.protocol];
if (Number(urlObj.port) === port) {
delete urlObj.port;
}
// remove duplicate slashes
if (urlObj.pathname) {
urlObj.pathname = urlObj.pathname.replace(/\/{2,}/g, '/');
}
// decode URI octets
if (urlObj.pathname) {
urlObj.pathname = decodeURI(urlObj.pathname);
}
// remove directory index
if (opts.removeDirectoryIndex === true) {
opts.removeDirectoryIndex = [/^index\.[a-z]+$/];
}
if (Array.isArray(opts.removeDirectoryIndex) && opts.removeDirectoryIndex.length) {
var pathComponents = urlObj.pathname.split('/');
var lastComponent = pathComponents[pathComponents.length - 1];
if (testParameter(lastComponent, opts.removeDirectoryIndex)) {
pathComponents = pathComponents.slice(0, pathComponents.length - 1);
urlObj.pathname = pathComponents.slice(1).join('/') + '/';
}
}
// resolve relative paths, but only for slashed protocols
if (slashedProtocol[urlObj.protocol]) {
var domain = urlObj.protocol + '//' + urlObj.hostname;
var relative = url.resolve(domain, urlObj.pathname);
urlObj.pathname = relative.replace(domain, '');
}
if (urlObj.hostname) {
// IDN to Unicode
urlObj.hostname = punycode.toUnicode(urlObj.hostname).toLowerCase();
// remove trailing dot
urlObj.hostname = urlObj.hostname.replace(/\.$/, '');
// remove `www.`
if (opts.stripWWW) {
urlObj.hostname = urlObj.hostname.replace(/^www\./, '');
}
}
// remove URL with empty query string
if (urlObj.search === '?') {
delete urlObj.search;
}
var queryParameters = queryString.parse(urlObj.search);
// remove query unwanted parameters
if (Array.isArray(opts.removeQueryParameters)) {
for (var key in queryParameters) {
if (testParameter(key, opts.removeQueryParameters)) {
delete queryParameters[key];
}
}
}
// sort query parameters
urlObj.search = queryString.stringify(sortKeys(queryParameters));
// decode query parameters
urlObj.search = decodeURIComponent(urlObj.search);
// take advantage of many of the Node `url` normalizations
str = url.format(urlObj);
// remove ending `/`
if (opts.removeTrailingSlash || urlObj.pathname === '/') {
str = str.replace(/\/$/, '');
}
// restore relative protocol, if applicable
if (hasRelativeProtocol && !opts.normalizeProtocol) {
str = str.replace(/^http:\/\//, '//');
}
return str;
};
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.
@@ -0,0 +1,82 @@
{
"_from": "normalize-url@1.9.1",
"_id": "normalize-url@1.9.1",
"_inBundle": false,
"_integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=",
"_location": "/mini-css-extract-plugin/normalize-url",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "normalize-url@1.9.1",
"name": "normalize-url",
"escapedName": "normalize-url",
"rawSpec": "1.9.1",
"saveSpec": null,
"fetchSpec": "1.9.1"
},
"_requiredBy": [
"/mini-css-extract-plugin"
],
"_resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz",
"_shasum": "2cc0d66b31ea23036458436e3620d85954c66c3c",
"_spec": "normalize-url@1.9.1",
"_where": "/home/george/citwa/red_de_investigacion_front/first/node_modules/mini-css-extract-plugin",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/normalize-url/issues"
},
"bundleDependencies": false,
"dependencies": {
"object-assign": "^4.0.1",
"prepend-http": "^1.0.0",
"query-string": "^4.1.0",
"sort-keys": "^1.0.0"
},
"deprecated": false,
"description": "Normalize a URL",
"devDependencies": {
"ava": "*",
"xo": "^0.16.0"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/normalize-url#readme",
"keywords": [
"normalize",
"url",
"uri",
"address",
"string",
"str",
"normalise",
"normalization",
"normalisation",
"query",
"string",
"querystring",
"unicode",
"simplify",
"strip",
"trim",
"canonical"
],
"license": "MIT",
"name": "normalize-url",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/normalize-url.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.9.1"
}
@@ -0,0 +1,156 @@
# normalize-url [![Build Status](https://travis-ci.org/sindresorhus/normalize-url.svg?branch=master)](https://travis-ci.org/sindresorhus/normalize-url)
> [Normalize](http://en.wikipedia.org/wiki/URL_normalization) a URL
Useful when you need to display, store, deduplicate, sort, compare, etc, URLs.
## Install
```
$ npm install --save normalize-url
```
## Usage
```js
const normalizeUrl = require('normalize-url');
normalizeUrl('sindresorhus.com');
//=> 'http://sindresorhus.com'
normalizeUrl('HTTP://xn--xample-hva.com:80/?b=bar&a=foo');
//=> 'http://êxample.com/?a=foo&b=bar'
```
## API
### normalizeUrl(url, [options])
#### url
Type: `string`
URL to normalize.
#### options
##### normalizeProtocol
Type: `boolean`<br>
Default: `true`
Prepend `http:` to the URL if it's protocol-relative.
```js
normalizeUrl('//sindresorhus.com:80/');
//=> 'http://sindresorhus.com'
normalizeUrl('//sindresorhus.com:80/', {normalizeProtocol: false});
//=> '//sindresorhus.com'
```
##### normalizeHttps
Type: `boolean`<br>
Default: `false`
Normalize `https:` URLs to `http:`.
```js
normalizeUrl('https://sindresorhus.com:80/');
//=> 'https://sindresorhus.com'
normalizeUrl('https://sindresorhus.com:80/', {normalizeHttps: true});
//=> 'http://sindresorhus.com'
```
##### stripFragment
Type: `boolean`<br>
Default: `true`
Remove the fragment at the end of the URL.
```js
normalizeUrl('sindresorhus.com/about.html#contact');
//=> 'http://sindresorhus.com/about.html'
normalizeUrl('sindresorhus.com/about.html#contact', {stripFragment: false});
//=> 'http://sindresorhus.com/about.html#contact'
```
##### stripWWW
Type: `boolean`<br>
Default: `true`
Remove `www.` from the URL.
```js
normalizeUrl('http://www.sindresorhus.com/about.html#contact');
//=> 'http://sindresorhus.com/about.html#contact'
normalizeUrl('http://www.sindresorhus.com/about.html#contact', {stripWWW: false});
//=> 'http://www.sindresorhus.com/about.html#contact'
```
##### removeQueryParameters
Type: `Array<RegExp|string>`<br>
Default: `[/^utm_\w+/i]`
Remove query parameters that matches any of the provided strings or regexes.
```js
normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
removeQueryParameters: ['ref']
});
//=> 'http://sindresorhus.com/?foo=bar'
```
##### removeTrailingSlash
Type: `boolean`<br>
Default: `true`
Remove trailing slash.
**Note:** Trailing slash is always removed if the URL doesn't have a pathname.
```js
normalizeUrl('http://sindresorhus.com/redirect/');
//=> 'http://sindresorhus.com/redirect'
normalizeUrl('http://sindresorhus.com/redirect/', {removeTrailingSlash: false});
//=> 'http://sindresorhus.com/redirect/'
normalizeUrl('http://sindresorhus.com/', {removeTrailingSlash: false});
//=> 'http://sindresorhus.com'
```
##### removeDirectoryIndex
Type: `boolean` `Array<RegExp|string>`<br>
Default: `false`
Remove the default directory index file from path that matches any of the provided strings or regexes. When `true`, the regex `/^index\.[a-z]+$/` is used.
```js
normalizeUrl('www.sindresorhus.com/foo/default.php', {
removeDirectoryIndex: [/^default\.[a-z]+$/]
});
//=> 'http://sindresorhus.com/foo'
```
## Related
- [compare-urls](https://github.com/sindresorhus/compare-urls) - Compare URLs by first normalizing them
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,134 @@
# 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.0.0"></a>
# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07)
### Features
* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef))
<a name="0.4.7"></a>
## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07)
### Bug Fixes
* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4))
<a name="0.4.6"></a>
## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06)
### Bug Fixes
* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81))
* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5))
<a name="0.4.5"></a>
## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13)
### Bug Fixes
* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f))
* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba))
<a name="0.4.4"></a>
## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13)
### Bug Fixes
* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6))
<a name="0.4.3"></a>
## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14)
### Bug Fixes
* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda))
* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791))
<a name="0.4.2"></a>
## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09)
### Bug Fixes
* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e))
<a name="0.4.1"></a>
## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03)
### Bug Fixes
* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974))
<a name="0.4.0"></a>
# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28)
### Features
* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816))
<a name="0.3.0"></a>
# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29)
### Features
* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb))
<a name="0.2.1"></a>
## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13)
### Bug Fixes
* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363))
* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f))
<a name="0.2.0"></a>
# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12)
<a name="0.1.0"></a>
# 0.1.0 (2017-03-07)
### Features
* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b))
# 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.
+20
View 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.
@@ -0,0 +1,149 @@
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![test][test]][test-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
<div align="center">
<a href="http://json-schema.org">
<img width="160" height="160"
src="https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/docs/logo.png">
</a>
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Schema Utils</h1>
</div>
<h2 align="center">Install</h2>
```bash
npm i schema-utils
```
<h2 align="center">Usage</h2>
### `validateOptions`
**`schema.json`**
```js
{
"type": "object",
"properties": {
// Options...
},
"additionalProperties": false
}
```
#### Error Messages (Custom)
**`schema.json`**
```js
{
"type": "object",
"properties": {
"option": {
"type": [ "boolean" ]
}
},
// Overrides the default err.message for option
"errorMessage": {
"option": "should be {Boolean} (https:/github.com/org/repo#anchor)"
}
"additionalProperties": false
}
```
```js
import schema from 'path/to/schema.json'
import validateOptions from 'schema-utils'
validateOptions(schema, options, 'Loader/Plugin Name')
```
<h2 align="center">Examples</h2>
**schema.json**
```json
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"test": {
"anyOf": [
{ "type": "array" },
{ "type": "string" },
{ "instanceof": "RegExp" }
]
},
"transform": {
"instanceof": "Function"
},
"sourceMap": {
"type": "boolean"
}
},
"additionalProperties": false
}
```
### `Loader`
```js
import { getOptions } from 'loader-utils'
import validateOptions from 'schema-utils'
import schema from 'path/to/schema.json'
function loader (src, map) {
const options = getOptions(this) || {}
validateOptions(schema, options, 'Loader Name')
// Code...
}
```
### `Plugin`
```js
import validateOptions from 'schema-utils'
import schema from 'path/to/schema.json'
class Plugin {
constructor (options) {
validateOptions(schema, options, 'Plugin Name')
this.options = options
}
apply (compiler) {
// Code...
}
}
```
[npm]: https://img.shields.io/npm/v/schema-utils.svg
[npm-url]: https://npmjs.com/package/schema-utils
[node]: https://img.shields.io/node/v/schema-utils.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack-contrib/schema-utils.svg
[deps-url]: https://david-dm.org/webpack-contrib/schema-utils
[test]: http://img.shields.io/travis/webpack-contrib/schema-utils.svg
[test-url]: https://travis-ci.org/webpack-contrib/schema-utils
[cover]: https://codecov.io/gh/webpack-contrib/schema-utils/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/schema-utils
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack
@@ -0,0 +1,74 @@
{
"_from": "schema-utils@^1.0.0",
"_id": "schema-utils@1.0.0",
"_inBundle": false,
"_integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"_location": "/mini-css-extract-plugin/schema-utils",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "schema-utils@^1.0.0",
"name": "schema-utils",
"escapedName": "schema-utils",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/mini-css-extract-plugin"
],
"_resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"_shasum": "0b79a93204d7b600d4b2850d1f66c2a34951c770",
"_spec": "schema-utils@^1.0.0",
"_where": "/home/george/citwa/red_de_investigacion_front/first/node_modules/mini-css-extract-plugin",
"author": {
"name": "webpack Contrib",
"url": "https://github.com/webpack-contrib"
},
"bugs": {
"url": "https://github.com/webpack-contrib/schema-utils/issues"
},
"bundleDependencies": false,
"dependencies": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
},
"deprecated": false,
"description": "webpack Validation Utils",
"devDependencies": {
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.0",
"@webpack-contrib/eslint-config-webpack": "^2.0.0",
"del-cli": "^1.0.0",
"eslint": "^5.0.0",
"eslint-plugin-import": "^2.0.0",
"eslint-plugin-prettier": "^2.0.0",
"jest": "^21.0.0",
"prettier": "^1.0.0",
"standard-version": "^4.0.0"
},
"engines": {
"node": ">= 4"
},
"files": [
"src"
],
"homepage": "https://github.com/webpack-contrib/schema-utils",
"license": "MIT",
"main": "src/index.js",
"name": "schema-utils",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack-contrib/schema-utils.git"
},
"scripts": {
"clean": "del-cli coverage",
"commits": "commitlint --from $(git rev-list --tags --max-count=1)",
"lint": "eslint --cache src test",
"release": "npm run commits && standard-version",
"test": "jest --env node --verbose --coverage"
},
"version": "1.0.0"
}
@@ -0,0 +1,30 @@
/* eslint-disable
strict,
no-param-reassign
*/
'use strict';
class ValidationError extends Error {
constructor(errors, name) {
super();
this.name = 'ValidationError';
this.message = `${name || ''} Invalid Options\n\n`;
this.errors = errors.map((err) => {
err.dataPath = err.dataPath.replace(/\//g, '.');
return err;
});
this.errors.forEach((err) => {
this.message += `options${err.dataPath} ${err.message}\n`;
});
Error.captureStackTrace(this, this.constructor);
}
}
module.exports = ValidationError;
@@ -0,0 +1,9 @@
/* eslint-disable
strict
*/
'use strict';
const validateOptions = require('./validateOptions');
module.exports = validateOptions;
@@ -0,0 +1,38 @@
/* eslint-disable
strict,
no-param-reassign
*/
'use strict';
const fs = require('fs');
const path = require('path');
const Ajv = require('ajv');
const errors = require('ajv-errors');
const keywords = require('ajv-keywords');
const ValidationError = require('./ValidationError');
const ajv = new Ajv({
allErrors: true,
jsonPointers: true,
});
errors(ajv);
keywords(ajv, ['instanceof', 'typeof']);
const validateOptions = (schema, options, name) => {
if (typeof schema === 'string') {
schema = fs.readFileSync(path.resolve(schema), 'utf8');
schema = JSON.parse(schema);
}
if (!ajv.validate(schema, options)) {
throw new ValidationError(ajv.errors, name);
}
return true;
};
module.exports = validateOptions;
+125
View File
@@ -0,0 +1,125 @@
{
"_from": "mini-css-extract-plugin@^0.8.0",
"_id": "mini-css-extract-plugin@0.8.0",
"_inBundle": false,
"_integrity": "sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw==",
"_location": "/mini-css-extract-plugin",
"_phantomChildren": {
"ajv": "6.10.2",
"ajv-errors": "1.0.1",
"ajv-keywords": "3.4.1",
"object-assign": "4.1.1",
"prepend-http": "1.0.4",
"query-string": "4.3.4",
"sort-keys": "1.1.2"
},
"_requested": {
"type": "range",
"registry": true,
"raw": "mini-css-extract-plugin@^0.8.0",
"name": "mini-css-extract-plugin",
"escapedName": "mini-css-extract-plugin",
"rawSpec": "^0.8.0",
"saveSpec": null,
"fetchSpec": "^0.8.0"
},
"_requiredBy": [
"/@vue/cli-service"
],
"_resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz",
"_shasum": "81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1",
"_spec": "mini-css-extract-plugin@^0.8.0",
"_where": "/home/george/citwa/red_de_investigacion_front/first/node_modules/@vue/cli-service",
"author": {
"name": "Tobias Koppers @sokra"
},
"bugs": {
"url": "https://github.com/webpack-contrib/mini-css-extract-plugin/issues"
},
"bundleDependencies": false,
"dependencies": {
"loader-utils": "^1.1.0",
"normalize-url": "1.9.1",
"schema-utils": "^1.0.0",
"webpack-sources": "^1.1.0"
},
"deprecated": false,
"description": "extracts CSS into separate files",
"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/preset-env": "^7.5.4",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@webpack-contrib/defaults": "^5.0.2",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"commitlint-azure-pipelines-cli": "^1.0.2",
"cross-env": "^5.2.0",
"css-loader": "^3.0.0",
"del": "^4.1.1",
"del-cli": "^1.1.0",
"es-check": "^5.0.0",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.0",
"file-loader": "^4.0.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"jest-junit": "^6.4.0",
"lint-staged": "^9.2.0",
"memory-fs": "^0.4.1",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"standard-version": "^6.0.1",
"webpack": "^4.35.3",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2"
},
"engines": {
"node": ">= 6.9.0"
},
"files": [
"dist"
],
"homepage": "https://github.com/webpack-contrib/mini-css-extract-plugin",
"keywords": [
"webpack",
"css",
"extract",
"hmr"
],
"license": "MIT",
"main": "dist/cjs.js",
"name": "mini-css-extract-plugin",
"peerDependencies": {
"webpack": "^4.4.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack-contrib/mini-css-extract-plugin.git"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files",
"clean": "del-cli dist",
"commitlint": "commitlint --from=master",
"defaults": "webpack-defaults",
"lint": "npm-run-all -l -p \"lint:**\"",
"lint:js": "eslint --cache src test",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
"postbuild": "es-check es5 dist/hmr/hotModuleReplacement.js",
"prebuild": "npm run clean",
"prepare": "npm run build",
"pretest": "npm run lint",
"release": "standard-version",
"security": "npm audit",
"start": "npm run build -- -w",
"test": "cross-env NODE_ENV=test npm run test:coverage",
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:manual": "webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
"test:only": "cross-env NODE_ENV=test jest",
"test:watch": "cross-env NODE_ENV=test jest --watch"
},
"version": "0.8.0"
}