mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 05:32:18 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
184
web/node_modules/mini-css-extract-plugin/CHANGELOG.md
generated
vendored
Normal file
184
web/node_modules/mini-css-extract-plugin/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
# 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.11.3](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.11.2...v0.11.3) (2020-10-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better support for webpack 5 ([#595](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/595)) ([6e09a51](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/6e09a51954aee1c8db904747e0b9bc42d14e7b47))
|
||||
|
||||
### [0.11.2](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.11.1...v0.11.2) (2020-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cache for webpack@5 ([6a27b30](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/6a27b30fea43d2d179d7df5deb260887d6b45ccc))
|
||||
|
||||
### [0.11.1](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.11.0...v0.11.1) (2020-09-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* added cache serializer for webpack@5 ([#581](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/581)) ([d09693e](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/d09693e7d50858c319a804736cf9609479140ad8))
|
||||
|
||||
### [0.11.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.10.0...v0.11.0) (2020-08-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* named export ([1ea4b7f](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/1ea4b7fe8305fcca7915d5c1dccd6041bab2c053))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* compatibility with webpack@5
|
||||
|
||||
### [0.10.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.9.0...v0.10.0) (2020-08-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* schema validation ([#480](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/480)) ([b197757](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/b197757e26af717a302485293a2b95bc0eb6cf71))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add semicolon to avoid `Uncaught TypeError` on Webpack v5 ([#561](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/561)) ([3974210](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/3974210ec820f47cf717cd0829d4e4e3879a518a))
|
||||
* enforce esm ([#546](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/546)) ([b146549](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/b1465491b1706e0f450cf69df4cf8176799907d1))
|
||||
* partial compatibility with `webpack@5` ([#477](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/477)) ([903a56e](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/903a56ea3fa08e173cd548d23089d0cee25bafea))
|
||||
|
||||
### [0.9.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.8.2...v0.9.0) (2019-12-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* new `esModule` option ([#475](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/475)) ([596e47a](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/596e47a8aead53f9cc0e2b1e09a2c20e455e45c1))
|
||||
|
||||
### [0.8.2](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.8.1...v0.8.2) (2019-12-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* context for dependencies ([#474](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/474)) ([0269860](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/0269860adb0eaad477901188eea66693fedf7769))
|
||||
|
||||
### [0.8.1](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v0.8.0...v0.8.1) (2019-12-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use filename mutated after instantiation ([#430](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/430)) ([0bacfac](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/0bacfac7ef4a06b4810fbc140875f7a038caa5bc))
|
||||
* improve warning of conflict order ([#465](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/465)) ([357d073](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/357d073bf0259f2c44e613ad4dfcbcc8354e4be3))
|
||||
* support ES module syntax ([#472](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/472)) ([2f72e1a](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/2f72e1aa267de23f121441714e88406f579e77b2))
|
||||
|
||||
## [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
web/node_modules/mini-css-extract-plugin/LICENSE
generated
vendored
Normal file
20
web/node_modules/mini-css-extract-plugin/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
692
web/node_modules/mini-css-extract-plugin/README.md
generated
vendored
Normal file
692
web/node_modules/mini-css-extract-plugin/README.md
generated
vendored
Normal file
|
@ -0,0 +1,692 @@
|
|||
<div align="center">
|
||||
<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]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
[![size][size]][size-url]
|
||||
|
||||
# mini-css-extract-plugin
|
||||
|
||||
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
|
||||
|
||||
## Getting Started
|
||||
|
||||
To begin, you'll need to install `mini-css-extract-plugin`:
|
||||
|
||||
```bash
|
||||
npm install --save-dev mini-css-extract-plugin
|
||||
```
|
||||
|
||||
It's recommended to combine `mini-css-extract-plugin` with the [`css-loader`](https://github.com/webpack-contrib/css-loader)
|
||||
|
||||
Then add the loader and the plugin to your `webpack` config. For example:
|
||||
|
||||
**style.css**
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
**component.js**
|
||||
|
||||
```js
|
||||
import './style.css';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [new MiniCssExtractPlugin()],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `publicPath`
|
||||
|
||||
Type: `String|Function`
|
||||
Default: the `publicPath` in `webpackOptions.output`
|
||||
|
||||
Specifies a custom public path for the target file(s).
|
||||
|
||||
#### `String`
|
||||
|
||||
**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: '/public/path/to/',
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
#### `Function`
|
||||
|
||||
**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) => {
|
||||
return path.relative(path.dirname(resourcePath), context) + '/';
|
||||
},
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `esModule`
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, `mini-css-extract-plugin` generates JS modules that use the CommonJS modules syntax.
|
||||
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).
|
||||
|
||||
You can enable a ES module syntax using:
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [new MiniCssExtractPlugin()],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
esModule: true,
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `modules`
|
||||
|
||||
Type: `Object`
|
||||
Default: `undefined`
|
||||
|
||||
Configuration CSS Modules.
|
||||
|
||||
#### `namedExport`
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Enables/disables ES modules named export for locals.
|
||||
|
||||
> ⚠ Names of locals are converted to `camelCase`.
|
||||
|
||||
> ⚠ It is not allowed to use JavaScript reserved words in css class names.
|
||||
|
||||
> ⚠ Options `esModule` and `modules.namedExport` in `css-loader` and `MiniCssExtractPlugin.loader` should be enabled.
|
||||
|
||||
**styles.css**
|
||||
|
||||
```css
|
||||
.foo-baz {
|
||||
color: red;
|
||||
}
|
||||
.bar {
|
||||
color: blue;
|
||||
}
|
||||
```
|
||||
|
||||
**index.js**
|
||||
|
||||
```js
|
||||
import { fooBaz, bar } from './styles.css';
|
||||
|
||||
console.log(fooBaz, bar);
|
||||
```
|
||||
|
||||
You can enable a ES module named export using:
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [new MiniCssExtractPlugin()],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
esModule: true,
|
||||
modules: {
|
||||
namedExport: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
esModule: true,
|
||||
modules: {
|
||||
namedExport: true,
|
||||
localIdentName: 'foo__[name]__[local]',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### 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', // webpack 4 only
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### The `publicPath` option as function
|
||||
|
||||
**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', // webpack 4 only
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Hot Module Reloading (HMR)
|
||||
|
||||
Note: HMR is automatically supported in webpack 5. No need to configure it. Skip the following:
|
||||
|
||||
The `mini-css-extract-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 (webpack 4 only)
|
||||
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'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
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.
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({
|
||||
moduleFilename: ({ name }) => `${name.replace('/js/', '/css/')}.css`,
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Long Term Caching
|
||||
|
||||
For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`.
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].[contenthash].css',
|
||||
chunkFilename: '[id].[contenthash].css',
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({
|
||||
ignoreOrder: true,
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 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)
|
||||
|
||||
## Contributing
|
||||
|
||||
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
||||
|
||||
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
||||
|
||||
## 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://github.com/webpack-contrib/mini-css-extract-plugin/workflows/mini-css-extract-plugin/badge.svg
|
||||
[tests-url]: https://github.com/webpack-contrib/mini-css-extract-plugin/actions
|
||||
[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://badges.gitter.im/webpack/webpack.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
|
75
web/node_modules/mini-css-extract-plugin/dist/CssDependency.js
generated
vendored
Normal file
75
web/node_modules/mini-css-extract-plugin/dist/CssDependency.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _webpack = _interopRequireDefault(require("webpack"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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}`;
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const {
|
||||
write
|
||||
} = context;
|
||||
write(this.identifier);
|
||||
write(this.content);
|
||||
write(this.media);
|
||||
write(this.sourceMap);
|
||||
write(this.context);
|
||||
write(this.identifierIndex);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
super.deserialize(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_webpack.default.util && _webpack.default.util.serialization) {
|
||||
_webpack.default.util.serialization.register(CssDependency, 'mini-css-extract-plugin/dist/CssDependency', null, {
|
||||
serialize(instance, context) {
|
||||
instance.serialize(context);
|
||||
},
|
||||
|
||||
deserialize(context) {
|
||||
const {
|
||||
read
|
||||
} = context;
|
||||
const dep = new CssDependency({
|
||||
identifier: read(),
|
||||
content: read(),
|
||||
media: read(),
|
||||
sourceMap: read()
|
||||
}, read(), read());
|
||||
dep.deserialize(context);
|
||||
return dep;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
var _default = CssDependency;
|
||||
exports.default = _default;
|
14
web/node_modules/mini-css-extract-plugin/dist/CssDependencyTemplate.js
generated
vendored
Normal file
14
web/node_modules/mini-css-extract-plugin/dist/CssDependencyTemplate.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class CssDependencyTemplate {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
apply() {}
|
||||
|
||||
}
|
||||
|
||||
exports.default = CssDependencyTemplate;
|
58
web/node_modules/mini-css-extract-plugin/dist/CssLoadingRuntimeModule.js
generated
vendored
Normal file
58
web/node_modules/mini-css-extract-plugin/dist/CssLoadingRuntimeModule.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
var _webpack = require("webpack");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
const {
|
||||
comparators: {
|
||||
compareModulesByIdentifier
|
||||
}
|
||||
} = _webpack.util;
|
||||
|
||||
const getCssChunkObject = (mainChunk, compilation) => {
|
||||
const obj = {};
|
||||
const {
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
|
||||
for (const chunk of mainChunk.getAllAsyncChunks()) {
|
||||
const modules = chunkGraph.getOrderedChunkModulesIterable(chunk, compareModulesByIdentifier);
|
||||
|
||||
for (const module of modules) {
|
||||
if (module.type === _utils.MODULE_TYPE) {
|
||||
obj[chunk.id] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
module.exports = class CssLoadingRuntimeModule extends _webpack.RuntimeModule {
|
||||
constructor(runtimeRequirements) {
|
||||
super('css loading', 10);
|
||||
this.runtimeRequirements = runtimeRequirements;
|
||||
}
|
||||
|
||||
generate() {
|
||||
const {
|
||||
chunk,
|
||||
compilation,
|
||||
runtimeRequirements
|
||||
} = this;
|
||||
const {
|
||||
runtimeTemplate,
|
||||
outputOptions: {
|
||||
crossOriginLoading
|
||||
}
|
||||
} = compilation;
|
||||
const chunkMap = getCssChunkObject(chunk, compilation);
|
||||
const withLoading = runtimeRequirements.has(_webpack.RuntimeGlobals.ensureChunkHandlers) && Object.keys(chunkMap).length > 0;
|
||||
const withHmr = runtimeRequirements.has(_webpack.RuntimeGlobals.hmrDownloadUpdateHandlers);
|
||||
if (!withLoading && !withHmr) return null;
|
||||
return _webpack.Template.asString([`var createStylesheet = ${runtimeTemplate.basicFunction('fullhref, resolve, reject', ['var linkTag = document.createElement("link");', 'linkTag.rel = "stylesheet";', 'linkTag.type = "text/css";', 'linkTag.onload = resolve;', 'linkTag.onerror = function(event) {', _webpack.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;', 'linkTag.parentNode.removeChild(linkTag)', 'reject(err);']), '};', 'linkTag.href = fullhref;', crossOriginLoading ? _webpack.Template.asString([`if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {`, _webpack.Template.indent(`linkTag.crossOrigin = ${JSON.stringify(crossOriginLoading)};`), '}']) : '', 'var head = document.getElementsByTagName("head")[0];', 'head.appendChild(linkTag);', 'return linkTag;'])};`, `var findStylesheet = ${runtimeTemplate.basicFunction('href, fullhref', ['var existingLinkTags = document.getElementsByTagName("link");', 'for(var i = 0; i < existingLinkTags.length; i++) {', _webpack.Template.indent(['var tag = existingLinkTags[i];', 'var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");', 'if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return tag;']), '}', 'var existingStyleTags = document.getElementsByTagName("style");', 'for(var i = 0; i < existingStyleTags.length; i++) {', _webpack.Template.indent(['var tag = existingStyleTags[i];', 'var dataHref = tag.getAttribute("data-href");', 'if(dataHref === href || dataHref === fullhref) return tag;']), '}'])};`, `var loadStylesheet = ${runtimeTemplate.basicFunction('chunkId', `return new Promise(${runtimeTemplate.basicFunction('resolve, reject', [`var href = ${_webpack.RuntimeGlobals.require}.miniCssF(chunkId);`, `var fullhref = ${_webpack.RuntimeGlobals.publicPath} + href;`, 'if(findStylesheet(href, fullhref)) return resolve();', 'createStylesheet(fullhref, resolve, reject);'])});`)}`, withLoading ? _webpack.Template.asString(['// object to store loaded CSS chunks', 'var installedCssChunks = {', _webpack.Template.indent(chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(',\n')), '};', '', `${_webpack.RuntimeGlobals.ensureChunkHandlers}.miniCss = ${runtimeTemplate.basicFunction('chunkId, promises', [`var cssChunks = ${JSON.stringify(chunkMap)};`, 'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);', 'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {', _webpack.Template.indent([`promises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(${runtimeTemplate.basicFunction('', 'installedCssChunks[chunkId] = 0;')}, ${runtimeTemplate.basicFunction('e', ['delete installedCssChunks[chunkId];', 'throw e;'])}));`]), '}'])};`]) : '// no chunk loading', '', withHmr ? _webpack.Template.asString(['var oldTags = [];', 'var newTags = [];', `var applyHandler = ${runtimeTemplate.basicFunction('options', [`return { dispose: ${runtimeTemplate.basicFunction('', ['for(var i = 0; i < oldTags.length; i++) {', _webpack.Template.indent(['var oldTag = oldTags[i];', 'if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);']), '}', 'oldTags.length = 0;'])}, apply: ${runtimeTemplate.basicFunction('', ['for(var i = 0; i < newTags.length; i++) newTags[i].rel = "stylesheet";', 'newTags.length = 0;'])} };`])}`, `${_webpack.RuntimeGlobals.hmrDownloadUpdateHandlers}.miniCss = ${runtimeTemplate.basicFunction('chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList', ['applyHandlers.push(applyHandler);', `chunkIds.forEach(${runtimeTemplate.basicFunction('chunkId', [`var href = ${_webpack.RuntimeGlobals.require}.miniCssF(chunkId);`, `var fullhref = ${_webpack.RuntimeGlobals.publicPath} + href;`, 'const oldTag = findStylesheet(href, fullhref);', 'if(!oldTag) return;', `promises.push(new Promise(${runtimeTemplate.basicFunction('resolve, reject', [`var tag = createStylesheet(fullhref, ${runtimeTemplate.basicFunction('', ['tag.as = "style";', 'tag.rel = "preload";', 'resolve();'])}, reject);`, 'oldTags.push(oldTag);', 'newTags.push(tag);'])}));`])});`])}`]) : '// no hmr']);
|
||||
}
|
||||
|
||||
};
|
150
web/node_modules/mini-css-extract-plugin/dist/CssModule.js
generated
vendored
Normal file
150
web/node_modules/mini-css-extract-plugin/dist/CssModule.js
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _webpack = _interopRequireDefault(require("webpack"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const TYPES = new Set([_utils.MODULE_TYPE]);
|
||||
const CODE_GENERATION_RESULT = {
|
||||
sources: new Map(),
|
||||
runtimeRequirements: new Set()
|
||||
};
|
||||
|
||||
class CssModule extends _webpack.default.Module {
|
||||
constructor({
|
||||
context,
|
||||
identifier,
|
||||
identifierIndex,
|
||||
content,
|
||||
media,
|
||||
sourceMap
|
||||
}) {
|
||||
super(_utils.MODULE_TYPE, context);
|
||||
this.id = '';
|
||||
this._context = context;
|
||||
this._identifier = identifier;
|
||||
this._identifierIndex = identifierIndex;
|
||||
this.content = content;
|
||||
this.media = media;
|
||||
this.sourceMap = sourceMap;
|
||||
this.buildInfo = {};
|
||||
this.buildMeta = {};
|
||||
} // no source() so webpack 4 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})` : ''}`;
|
||||
} // eslint-disable-next-line class-methods-use-this
|
||||
|
||||
|
||||
getSourceTypes() {
|
||||
return TYPES;
|
||||
} // eslint-disable-next-line class-methods-use-this
|
||||
|
||||
|
||||
codeGeneration() {
|
||||
return CODE_GENERATION_RESULT;
|
||||
}
|
||||
|
||||
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;
|
||||
} // eslint-disable-next-line class-methods-use-this
|
||||
|
||||
|
||||
needRebuild() {
|
||||
return true;
|
||||
} // eslint-disable-next-line class-methods-use-this
|
||||
|
||||
|
||||
needBuild(context, callback) {
|
||||
callback(null, false);
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fileSystem, callback) {
|
||||
this.buildInfo = {};
|
||||
this.buildMeta = {};
|
||||
callback();
|
||||
}
|
||||
|
||||
updateHash(hash, context) {
|
||||
super.updateHash(hash, context);
|
||||
hash.update(this.content);
|
||||
hash.update(this.media || '');
|
||||
hash.update(this.sourceMap ? JSON.stringify(this.sourceMap) : '');
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const {
|
||||
write
|
||||
} = context;
|
||||
write(this._context);
|
||||
write(this._identifier);
|
||||
write(this._identifierIndex);
|
||||
write(this.content);
|
||||
write(this.media);
|
||||
write(this.sourceMap);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
super.deserialize(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_webpack.default.util && _webpack.default.util.serialization) {
|
||||
_webpack.default.util.serialization.register(CssModule, 'mini-css-extract-plugin/dist/CssModule', null, {
|
||||
serialize(instance, context) {
|
||||
instance.serialize(context);
|
||||
},
|
||||
|
||||
deserialize(context) {
|
||||
const {
|
||||
read
|
||||
} = context;
|
||||
const dep = new CssModule({
|
||||
context: read(),
|
||||
identifier: read(),
|
||||
identifierIndex: read(),
|
||||
content: read(),
|
||||
media: read(),
|
||||
sourceMap: read()
|
||||
});
|
||||
dep.deserialize(context);
|
||||
return dep;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
var _default = CssModule;
|
||||
exports.default = _default;
|
22
web/node_modules/mini-css-extract-plugin/dist/CssModuleFactory.js
generated
vendored
Normal file
22
web/node_modules/mini-css-extract-plugin/dist/CssModuleFactory.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _CssModule = _interopRequireDefault(require("./CssModule"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class CssModuleFactory {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
create({
|
||||
dependencies: [dependency]
|
||||
}, callback) {
|
||||
callback(null, new _CssModule.default(dependency));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = CssModuleFactory;
|
3
web/node_modules/mini-css-extract-plugin/dist/cjs.js
generated
vendored
Normal file
3
web/node_modules/mini-css-extract-plugin/dist/cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = require('./index').default;
|
211
web/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js
generated
vendored
Normal file
211
web/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js
generated
vendored
Normal 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);
|
||||
};
|
484
web/node_modules/mini-css-extract-plugin/dist/index.js
generated
vendored
Normal file
484
web/node_modules/mini-css-extract-plugin/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,484 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _webpack = _interopRequireWildcard(require("webpack"));
|
||||
|
||||
var _schemaUtils = _interopRequireDefault(require("schema-utils"));
|
||||
|
||||
var _CssModuleFactory = _interopRequireDefault(require("./CssModuleFactory"));
|
||||
|
||||
var _CssDependencyTemplate = _interopRequireDefault(require("./CssDependencyTemplate"));
|
||||
|
||||
var _CssDependency = _interopRequireDefault(require("./CssDependency"));
|
||||
|
||||
var _pluginOptions = _interopRequireDefault(require("./plugin-options.json"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/* eslint-disable class-methods-use-this */
|
||||
// webpack 5 exposes the sources property to ensure the right version of webpack-sources is used
|
||||
const {
|
||||
ConcatSource,
|
||||
SourceMapSource,
|
||||
OriginalSource
|
||||
} = // eslint-disable-next-line global-require
|
||||
_webpack.default.sources || require('webpack-sources');
|
||||
|
||||
const {
|
||||
Template,
|
||||
util: {
|
||||
createHash
|
||||
}
|
||||
} = _webpack.default;
|
||||
const isWebpack4 = _webpack.version[0] === '4';
|
||||
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 MiniCssExtractPlugin {
|
||||
constructor(options = {}) {
|
||||
(0, _schemaUtils.default)(_pluginOptions.default, options, 'Mini CSS Extract Plugin');
|
||||
this.options = Object.assign({
|
||||
filename: DEFAULT_FILENAME,
|
||||
moduleFilename: () => this.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');
|
||||
}
|
||||
}
|
||||
|
||||
if (!isWebpack4 && 'hmr' in this.options) {
|
||||
throw new Error("The 'hmr' option doesn't exist for the mini-css-extract-plugin when using webpack 5 (it's automatically determined)");
|
||||
}
|
||||
}
|
||||
/** @param {import("webpack").Compiler} compiler */
|
||||
|
||||
|
||||
apply(compiler) {
|
||||
if (!isWebpack4) {
|
||||
const {
|
||||
splitChunks
|
||||
} = compiler.options.optimization;
|
||||
|
||||
if (splitChunks) {
|
||||
if (splitChunks.defaultSizeTypes.includes('...')) {
|
||||
splitChunks.defaultSizeTypes.push(_utils.MODULE_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
||||
compilation.dependencyFactories.set(_CssDependency.default, new _CssModuleFactory.default());
|
||||
compilation.dependencyTemplates.set(_CssDependency.default, new _CssDependencyTemplate.default());
|
||||
|
||||
if (isWebpack4) {
|
||||
compilation.mainTemplate.hooks.renderManifest.tap(pluginName, (result, {
|
||||
chunk
|
||||
}) => {
|
||||
const {
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
||||
|
||||
const filenameTemplate = chunk.filenameTemplate || (({
|
||||
chunk: chunkData
|
||||
}) => this.options.moduleFilename(chunkData));
|
||||
|
||||
if (renderedModules.length > 0) {
|
||||
result.push({
|
||||
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
||||
filenameTemplate,
|
||||
pathOptions: {
|
||||
chunk,
|
||||
contentHashType: _utils.MODULE_TYPE
|
||||
},
|
||||
identifier: `${pluginName}.${chunk.id}`,
|
||||
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
||||
});
|
||||
}
|
||||
});
|
||||
compilation.chunkTemplate.hooks.renderManifest.tap(pluginName, (result, {
|
||||
chunk
|
||||
}) => {
|
||||
const {
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
||||
const filenameTemplate = chunk.filenameTemplate || this.options.chunkFilename;
|
||||
|
||||
if (renderedModules.length > 0) {
|
||||
result.push({
|
||||
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
||||
filenameTemplate,
|
||||
pathOptions: {
|
||||
chunk,
|
||||
contentHashType: _utils.MODULE_TYPE
|
||||
},
|
||||
identifier: `${pluginName}.${chunk.id}`,
|
||||
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
compilation.hooks.renderManifest.tap(pluginName, (result, {
|
||||
chunk
|
||||
}) => {
|
||||
const {
|
||||
chunkGraph
|
||||
} = compilation; // We don't need hot update chunks for css
|
||||
// We will use the real asset instead to update
|
||||
|
||||
if (chunk instanceof _webpack.default.HotUpdateChunk) return;
|
||||
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
||||
const filenameTemplate = chunk.canBeInitial() ? ({
|
||||
chunk: chunkData
|
||||
}) => this.options.moduleFilename(chunkData) : this.options.chunkFilename;
|
||||
|
||||
if (renderedModules.length > 0) {
|
||||
result.push({
|
||||
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
||||
filenameTemplate,
|
||||
pathOptions: {
|
||||
chunk,
|
||||
contentHashType: _utils.MODULE_TYPE
|
||||
},
|
||||
identifier: `${pluginName}.${chunk.id}`,
|
||||
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
* For webpack 5 this will be unneeded once the logic uses a RuntimeModule
|
||||
* as the content of runtime modules is hashed and added to the chunk hash automatically
|
||||
* */
|
||||
|
||||
|
||||
if (isWebpack4) {
|
||||
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[_utils.MODULE_TYPE] || {}));
|
||||
}
|
||||
|
||||
if (REGEXP_NAME.test(chunkFilename)) {
|
||||
hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
compilation.hooks.contentHash.tap(pluginName, chunk => {
|
||||
const {
|
||||
outputOptions,
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
const {
|
||||
hashFunction,
|
||||
hashDigest,
|
||||
hashDigestLength
|
||||
} = outputOptions;
|
||||
const hash = createHash(hashFunction);
|
||||
|
||||
for (const m of this.getChunkModules(chunk, chunkGraph)) {
|
||||
if (m.type === _utils.MODULE_TYPE) {
|
||||
m.updateHash(hash, {
|
||||
chunkGraph
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
contentHash
|
||||
} = chunk;
|
||||
contentHash[_utils.MODULE_TYPE] = hash.digest(hashDigest).substring(0, hashDigestLength);
|
||||
});
|
||||
const {
|
||||
mainTemplate
|
||||
} = compilation;
|
||||
|
||||
if (isWebpack4) {
|
||||
mainTemplate.hooks.localVars.tap(pluginName, (source, chunk) => {
|
||||
const chunkMap = this.getCssChunkObject(chunk, compilation);
|
||||
|
||||
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, compilation);
|
||||
|
||||
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: {
|
||||
[_utils.MODULE_TYPE]: `" + ${JSON.stringify(chunkMaps.contentHash[_utils.MODULE_TYPE])}[chunkId] + "`
|
||||
},
|
||||
contentHashWithLength: {
|
||||
[_utils.MODULE_TYPE]: length => {
|
||||
const shortContentHashMap = {};
|
||||
const contentHash = chunkMaps.contentHash[_utils.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: _utils.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;
|
||||
});
|
||||
} else {
|
||||
const enabledChunks = new WeakSet();
|
||||
|
||||
const handler = (chunk, set) => {
|
||||
if (enabledChunks.has(chunk)) return;
|
||||
enabledChunks.add(chunk); // eslint-disable-next-line global-require
|
||||
|
||||
const CssLoadingRuntimeModule = require('./CssLoadingRuntimeModule');
|
||||
|
||||
set.add(_webpack.default.RuntimeGlobals.publicPath);
|
||||
compilation.addRuntimeModule(chunk, new _webpack.default.runtime.GetChunkFilenameRuntimeModule(_utils.MODULE_TYPE, 'mini-css', `${_webpack.default.RuntimeGlobals.require}.miniCssF`, referencedChunk => referencedChunk.canBeInitial() ? ({
|
||||
chunk: chunkData
|
||||
}) => this.options.moduleFilename(chunkData) : this.options.chunkFilename, true));
|
||||
compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set));
|
||||
};
|
||||
|
||||
compilation.hooks.runtimeRequirementInTree.for(_webpack.default.RuntimeGlobals.ensureChunkHandlers).tap(pluginName, handler);
|
||||
compilation.hooks.runtimeRequirementInTree.for(_webpack.default.RuntimeGlobals.hmrDownloadUpdateHandlers).tap(pluginName, handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getChunkModules(chunk, chunkGraph) {
|
||||
return typeof chunkGraph !== 'undefined' ? chunkGraph.getOrderedChunkModulesIterable(chunk, _utils.compareModulesByIdentifier) : chunk.modulesIterable;
|
||||
}
|
||||
|
||||
getCssChunkObject(mainChunk, compilation) {
|
||||
const obj = {};
|
||||
const {
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
|
||||
for (const chunk of mainChunk.getAllAsyncChunks()) {
|
||||
for (const module of this.getChunkModules(chunk, chunkGraph)) {
|
||||
if (module.type === _utils.MODULE_TYPE) {
|
||||
obj[chunk.id] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
renderContentAsset(compilation, chunk, modules, requestShortener) {
|
||||
let usedModules;
|
||||
const [chunkGroup] = chunk.groupsIterable;
|
||||
const moduleIndexFunctionName = typeof compilation.chunkGraph !== 'undefined' ? 'getModulePostOrderIndex' : 'getModuleIndex2';
|
||||
|
||||
if (typeof chunkGroup[moduleIndexFunctionName] === 'function') {
|
||||
// Store dependencies for modules
|
||||
const moduleDependencies = new Map(modules.map(m => [m, new Set()]));
|
||||
const moduleDependenciesReasons = new Map(modules.map(m => [m, new Map()])); // 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[moduleIndexFunctionName](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]);
|
||||
const reasons = moduleDependenciesReasons.get(sortedModules[i]);
|
||||
|
||||
for (let j = i + 1; j < sortedModules.length; j++) {
|
||||
const module = sortedModules[j];
|
||||
set.add(module);
|
||||
const reason = reasons.get(module) || new Set();
|
||||
reason.add(cg);
|
||||
reasons.set(module, reason);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
const reasons = moduleDependenciesReasons.get(fallbackModule);
|
||||
compilation.warnings.push(new Error([`chunk ${chunk.name || chunk.id} [${pluginName}]`, 'Conflicting order. Following module has been added:', ` * ${fallbackModule.readableIdentifier(requestShortener)}`, 'despite it was not able to fulfill desired ordering with these modules:', ...bestMatchDeps.map(m => {
|
||||
const goodReasonsMap = moduleDependenciesReasons.get(m);
|
||||
const goodReasons = goodReasonsMap && goodReasonsMap.get(fallbackModule);
|
||||
const failedChunkGroups = Array.from(reasons.get(m), cg => cg.name).join(', ');
|
||||
const goodChunkGroups = goodReasons && Array.from(goodReasons, cg => cg.name).join(', ');
|
||||
return [` * ${m.readableIdentifier(requestShortener)}`, ` - couldn't fulfill desired order of chunk group(s) ${failedChunkGroups}`, goodChunkGroups && ` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`].filter(Boolean).join('\n');
|
||||
})].join('\n')));
|
||||
}
|
||||
|
||||
usedModules.add(fallbackModule);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// fallback for older webpack versions
|
||||
// (to avoid a breaking change)
|
||||
// TODO remove this in next major 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;
|
35
web/node_modules/mini-css-extract-plugin/dist/loader-options.json
generated
vendored
Normal file
35
web/node_modules/mini-css-extract-plugin/dist/loader-options.json
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"publicPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"esModule": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"hmr": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reloadAll": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"modules": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"namedExport": {
|
||||
"description": "Enables/disables ES modules named export for locals (https://webpack.js.org/plugins/mini-css-extract-plugin/#namedexport).",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
216
web/node_modules/mini-css-extract-plugin/dist/loader.js
generated
vendored
Normal file
216
web/node_modules/mini-css-extract-plugin/dist/loader.js
generated
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.pitch = pitch;
|
||||
exports.default = _default;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _loaderUtils = _interopRequireDefault(require("loader-utils"));
|
||||
|
||||
var _webpack = require("webpack");
|
||||
|
||||
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 _NormalModule = _interopRequireDefault(require("webpack/lib/NormalModule"));
|
||||
|
||||
var _schemaUtils = _interopRequireDefault(require("schema-utils"));
|
||||
|
||||
var _CssDependency = _interopRequireDefault(require("./CssDependency"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _loaderOptions = _interopRequireDefault(require("./loader-options.json"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(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 pluginName = 'mini-css-extract-plugin';
|
||||
const isWebpack4 = _webpack.version[0] === '4';
|
||||
|
||||
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(_objectSpread({}, context.options), {}, {
|
||||
locals: !!context.locals
|
||||
}))});
|
||||
module.hot.dispose(cssReload);
|
||||
${accept}
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
function pitch(request) {
|
||||
const options = _loaderUtils.default.getOptions(this) || {};
|
||||
(0, _schemaUtils.default)(_loaderOptions.default, options, 'Mini CSS Extract Plugin Loader');
|
||||
const loaders = this.loaders.slice(this.loaderIndex + 1);
|
||||
this.addDependency(this.resourcePath);
|
||||
const childFilename = '*';
|
||||
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);
|
||||
childCompiler.hooks.thisCompilation.tap(`${pluginName} loader`, compilation => {
|
||||
const normalModuleHook = typeof _NormalModule.default.getCompilationHooks !== 'undefined' ? _NormalModule.default.getCompilationHooks(compilation).loader : compilation.hooks.normalModuleLoader;
|
||||
normalModuleHook.tap(`${pluginName} loader`, (loaderContext, module) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
loaderContext.emitFile = this.emitFile;
|
||||
|
||||
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;
|
||||
|
||||
if (isWebpack4) {
|
||||
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
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
childCompiler.hooks.compilation.tap(pluginName, compilation => {
|
||||
compilation.hooks.processAssets.tap(pluginName, () => {
|
||||
source = compilation.assets[childFilename] && compilation.assets[childFilename].source(); // Remove all chunk assets
|
||||
|
||||
compilation.chunks.forEach(chunk => {
|
||||
chunk.files.forEach(file => {
|
||||
compilation.deleteAsset(file);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const callback = this.async();
|
||||
childCompiler.runAsChild((err, entries, compilation) => {
|
||||
const addDependencies = dependencies => {
|
||||
if (!Array.isArray(dependencies) && dependencies != null) {
|
||||
throw new Error(`Exported value was not extracted as an array: ${JSON.stringify(dependencies)}`);
|
||||
}
|
||||
|
||||
const identifierCountMap = new Map();
|
||||
|
||||
for (const dependency of dependencies) {
|
||||
const count = identifierCountMap.get(dependency.identifier) || 0;
|
||||
|
||||
this._module.addDependency(new _CssDependency.default(dependency, dependency.context, count));
|
||||
|
||||
identifierCountMap.set(dependency.identifier, count + 1);
|
||||
}
|
||||
};
|
||||
|
||||
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 locals;
|
||||
const esModule = typeof options.esModule !== 'undefined' ? options.esModule : false;
|
||||
const namedExport = esModule && options.modules && options.modules.namedExport;
|
||||
|
||||
try {
|
||||
const originalExports = (0, _utils.evalModuleCode)(this, source, request); // eslint-disable-next-line no-underscore-dangle
|
||||
|
||||
exports = originalExports.__esModule ? originalExports.default : originalExports;
|
||||
|
||||
if (namedExport) {
|
||||
Object.keys(originalExports).forEach(key => {
|
||||
if (key !== 'default') {
|
||||
if (!locals) locals = {};
|
||||
locals[key] = originalExports[key];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
locals = exports && exports.locals;
|
||||
}
|
||||
|
||||
let dependencies;
|
||||
|
||||
if (!Array.isArray(exports)) {
|
||||
dependencies = [[null, exports]];
|
||||
} else {
|
||||
dependencies = exports.map(([id, content, media, sourceMap]) => {
|
||||
const module = (0, _utils.findModuleById)(compilation, id);
|
||||
return {
|
||||
identifier: module.identifier(),
|
||||
context: module.context,
|
||||
content,
|
||||
media,
|
||||
sourceMap
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
addDependencies(dependencies);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
|
||||
const result = locals ? namedExport ? Object.keys(locals).map(key => `\nexport const ${key} = ${JSON.stringify(locals[key])};`).join('') : `\n${esModule ? 'export default' : 'module.exports ='} ${JSON.stringify(locals)};` : esModule ? `\nexport {};` : '';
|
||||
let resultSource = `// extracted by ${pluginName}`;
|
||||
resultSource += options.hmr ? hotLoader(result, {
|
||||
context: this.context,
|
||||
options,
|
||||
locals
|
||||
}) : result;
|
||||
return callback(null, resultSource);
|
||||
});
|
||||
} // eslint-disable-next-line func-names
|
||||
|
||||
|
||||
function _default() {}
|
18
web/node_modules/mini-css-extract-plugin/dist/plugin-options.json
generated
vendored
Normal file
18
web/node_modules/mini-css-extract-plugin/dist/plugin-options.json
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"filename": {
|
||||
"type": "string"
|
||||
},
|
||||
"chunkFilename": {
|
||||
"type": "string"
|
||||
},
|
||||
"moduleFilename": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"ignoreOrder": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
65
web/node_modules/mini-css-extract-plugin/dist/utils.js
generated
vendored
Normal file
65
web/node_modules/mini-css-extract-plugin/dist/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findModuleById = findModuleById;
|
||||
exports.evalModuleCode = evalModuleCode;
|
||||
exports.compareModulesByIdentifier = compareModulesByIdentifier;
|
||||
exports.MODULE_TYPE = void 0;
|
||||
|
||||
var _module = _interopRequireDefault(require("module"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const MODULE_TYPE = 'css/mini-extract';
|
||||
exports.MODULE_TYPE = MODULE_TYPE;
|
||||
|
||||
function findModuleById(compilation, id) {
|
||||
const {
|
||||
modules,
|
||||
chunkGraph
|
||||
} = compilation;
|
||||
|
||||
for (const module of modules) {
|
||||
const moduleId = typeof chunkGraph !== 'undefined' ? chunkGraph.getModuleId(module) : module.id;
|
||||
|
||||
if (moduleId === id) {
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function evalModuleCode(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;
|
||||
}
|
||||
|
||||
function compareIds(a, b) {
|
||||
if (typeof a !== typeof b) {
|
||||
return typeof a < typeof b ? -1 : 1;
|
||||
}
|
||||
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (a > b) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function compareModulesByIdentifier(a, b) {
|
||||
return compareIds(a.identifier(), b.identifier());
|
||||
}
|
1
web/node_modules/mini-css-extract-plugin/node_modules/.bin/json5
generated
vendored
Symbolic link
1
web/node_modules/mini-css-extract-plugin/node_modules/.bin/json5
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../json5/lib/cli.js
|
274
web/node_modules/mini-css-extract-plugin/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
274
web/node_modules/mini-css-extract-plugin/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,274 @@
|
|||
### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
|
||||
|
||||
[c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
|
||||
[d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
|
||||
|
||||
This release includes a bug fix and minor change.
|
||||
|
||||
- Fix: `parse` throws on unclosed objects and arrays.
|
||||
|
||||
- New: `package.json5` has been removed until an easier way to keep it in sync
|
||||
with `package.json` is found.
|
||||
|
||||
|
||||
### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
|
||||
|
||||
[c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
|
||||
[d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major** JSON5 officially supports Node.js v4 and later. Support for Node.js
|
||||
v0.10 and v0.12 have been dropped.
|
||||
|
||||
- New: Unicode property names and Unicode escapes in property names are
|
||||
supported. ([#1])
|
||||
|
||||
- New: `stringify` outputs trailing commas in objects and arrays when a `space`
|
||||
option is provided. ([#66])
|
||||
|
||||
- New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
|
||||
in strings in order to be compatible with JSON. However, ES5 does not allow
|
||||
these characters in strings, so JSON5 gives a warning when they are parsed and
|
||||
escapes them when they are stringified. ([#70])
|
||||
|
||||
- New: `stringify` accepts an options object as its second argument. The
|
||||
supported options are `replacer`, `space`, and a new `quote` option that
|
||||
specifies the quote character used in strings. ([#71])
|
||||
|
||||
- New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
|
||||
`--validate` options. See `json5 --help` for more information. ([#72], [#84],
|
||||
and [#108])
|
||||
|
||||
- New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
|
||||
`\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
|
||||
and all other characters in the Space Separator Unicode category are allowed.
|
||||
|
||||
- New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
|
||||
`\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
|
||||
escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
|
||||
values and string property names.
|
||||
|
||||
- New: `stringify` outputs strings with single quotes by default but
|
||||
intelligently uses double quotes if there are more single quotes than double
|
||||
quotes inside the string. (i.e. `stringify('Stay here.')` outputs
|
||||
`'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
|
||||
|
||||
- New: When a character is not allowed in a string, `stringify` outputs a
|
||||
character escape like `\t` when available, a hexadecimal escape like `\x0F`
|
||||
when the Unicode code point is less than 256, or a Unicode character escape
|
||||
like `\u01FF`, in that order.
|
||||
|
||||
- New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
|
||||
stringifies its return value instead of the object. `toJSON5` overrides
|
||||
`toJSON` if they both exist.
|
||||
|
||||
- New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
|
||||
or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
|
||||
which still exists for backward compatibility but is deprecated and will give
|
||||
a warning.
|
||||
|
||||
- New: To use JSON5 in browsers, use the file at `dist/index.js` or
|
||||
`https://unpkg.com/json5@^1.0.0`.
|
||||
|
||||
- Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
|
||||
|
||||
- Fix: `isWord` no longer becomes a property of `JSON5` after calling
|
||||
`stringify`. ([#68] and [#89])
|
||||
|
||||
- Fix: `stringify` no longer throws when an object does not have a `prototype`.
|
||||
([#154])
|
||||
|
||||
- Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
|
||||
`toJSON5(key)` follows this pattern.
|
||||
|
||||
- Fix: `stringify` accepts `Number` and `String` objects as its `space`
|
||||
argument.
|
||||
|
||||
- Fix: In addition to a function, `stringify` also accepts an array of keys to
|
||||
include in the output as its `replacer` argument. Numbers, `Number` objects,
|
||||
and `String` objects will be converted to a string if they are given as array
|
||||
values.
|
||||
|
||||
|
||||
### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
|
||||
|
||||
[c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
|
||||
[d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
|
||||
|
||||
This release includes a minor fix for indentations when stringifying empty
|
||||
arrays.
|
||||
|
||||
- Fix: Indents no longer appear in empty arrays when stringified. ([#134])
|
||||
|
||||
|
||||
### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
|
||||
|
||||
[c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
|
||||
[d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
|
||||
Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
|
||||
remain.
|
||||
|
||||
- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
|
||||
|
||||
- New: `parse` and the CLI provide line and column numbers when displaying error
|
||||
messages. ([#101]; awesome work by [@amb26].)
|
||||
|
||||
|
||||
### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
|
||||
|
||||
[c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
|
||||
[d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
|
||||
|
||||
Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
|
||||
changelog entry includes v0.3.0 features.
|
||||
|
||||
This is a massive release that adds `stringify` support, among other things.
|
||||
|
||||
- **Major:** `JSON5.stringify()` now exists!
|
||||
This method is analogous to the native `JSON.stringify()`;
|
||||
it just avoids quoting keys where possible.
|
||||
See the [usage documentation](./README.md#usage) for more.
|
||||
([#32]; huge thanks and props [@aeisenberg]!)
|
||||
|
||||
- New: `NaN` and `-NaN` are now allowed number literals.
|
||||
([#30]; thanks [@rowanhill].)
|
||||
|
||||
- New: Duplicate object keys are now allowed; the last value is used.
|
||||
This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
|
||||
|
||||
- Fix: Properly handle various whitespace and newline cases now.
|
||||
E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
|
||||
and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
|
||||
([#58], [#60], and [#63]; thanks [@jordanbtucker].)
|
||||
|
||||
- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
|
||||
(They were disallowed in v0.2.0; see below.)
|
||||
It turns out they *are* valid in ES5, so JSON5 supports them now too.
|
||||
([#36]; thanks [@jordanbtucker]!)
|
||||
|
||||
|
||||
### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
|
||||
|
||||
[c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
|
||||
[d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
|
||||
|
||||
This release fixes some bugs and adds some more utility features to help you
|
||||
express data more easily:
|
||||
|
||||
- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
|
||||
While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
|
||||
in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
|
||||
and Node), so JSON5 officially rejects them now, too. ([#36])
|
||||
|
||||
- New: Trailing decimal points in decimal numbers are allowed again.
|
||||
(They were disallowed in v0.1.0; see below.)
|
||||
They're allowed by ES5, and differentiating between integers and floats may
|
||||
make sense on some platforms. ([#16]; thanks [@Midar].)
|
||||
|
||||
- New: `Infinity` and `-Infinity` are now allowed number literals.
|
||||
([#30]; thanks [@pepkin88].)
|
||||
|
||||
- New: Plus signs (`+`) in front of numbers are now allowed, since it can
|
||||
be helpful in some contexts to explicitly mark numbers as positive.
|
||||
(E.g. when a property represents changes or deltas.)
|
||||
|
||||
- Fix: unescaped newlines in strings are rejected now.
|
||||
([#24]; thanks [@Midar].)
|
||||
|
||||
|
||||
### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
|
||||
|
||||
[c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
|
||||
[d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
|
||||
|
||||
This release tightens JSON5 support and adds helpful utility features:
|
||||
|
||||
- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- Fix: Reject octal numbers properly now. Previously, they were accepted but
|
||||
improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
|
||||
leading zero). These are disallowed by both JSON5 and JSON, as well as by
|
||||
ES5's strict mode. (Thanks [@MaxNanasy].)
|
||||
|
||||
- New: Support leading decimal points in decimal numbers.
|
||||
(Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject trailing decimal points in decimal numbers now. These
|
||||
are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject omitted elements in arrays now. These are disallowed by
|
||||
both JSON5 and JSON.
|
||||
|
||||
- Fix: Throw proper `SyntaxError` instances on errors now.
|
||||
|
||||
- New: Add Node.js `require()` hook. Register via `json5/lib/require`.
|
||||
|
||||
- New: Add Node.js `json5` executable to compile JSON5 files to JSON.
|
||||
|
||||
|
||||
### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
|
||||
|
||||
[c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
|
||||
[d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
|
||||
|
||||
This was the first implementation of this JSON5 parser.
|
||||
|
||||
- Support unquoted object keys, including reserved words. Unicode characters
|
||||
and escape sequences sequences aren't yet supported.
|
||||
|
||||
- Support single-quoted strings.
|
||||
|
||||
- Support multi-line strings.
|
||||
|
||||
- Support trailing commas in arrays and objects.
|
||||
|
||||
- Support comments, both inline and block.
|
||||
|
||||
|
||||
### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
|
||||
|
||||
Let's consider this to be Douglas Crockford's original [json_parse.js] — a
|
||||
parser for the regular JSON format.
|
||||
|
||||
|
||||
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
|
||||
|
||||
[@MaxNanasy]: https://github.com/MaxNanasy
|
||||
[@Midar]: https://github.com/Midar
|
||||
[@pepkin88]: https://github.com/pepkin88
|
||||
[@rowanhill]: https://github.com/rowanhill
|
||||
[@aeisenberg]: https://github.com/aeisenberg
|
||||
[@jordanbtucker]: https://github.com/jordanbtucker
|
||||
[@amb26]: https://github.com/amb26
|
||||
|
||||
[#1]: https://github.com/json5/json5/issues/1
|
||||
[#16]: https://github.com/json5/json5/issues/16
|
||||
[#24]: https://github.com/json5/json5/issues/24
|
||||
[#30]: https://github.com/json5/json5/issues/30
|
||||
[#32]: https://github.com/json5/json5/issues/32
|
||||
[#36]: https://github.com/json5/json5/issues/36
|
||||
[#57]: https://github.com/json5/json5/issues/57
|
||||
[#58]: https://github.com/json5/json5/pull/58
|
||||
[#60]: https://github.com/json5/json5/pull/60
|
||||
[#63]: https://github.com/json5/json5/pull/63
|
||||
[#66]: https://github.com/json5/json5/issues/66
|
||||
[#67]: https://github.com/json5/json5/issues/67
|
||||
[#68]: https://github.com/json5/json5/issues/68
|
||||
[#70]: https://github.com/json5/json5/issues/70
|
||||
[#71]: https://github.com/json5/json5/issues/71
|
||||
[#72]: https://github.com/json5/json5/issues/72
|
||||
[#84]: https://github.com/json5/json5/pull/84
|
||||
[#89]: https://github.com/json5/json5/pull/89
|
||||
[#97]: https://github.com/json5/json5/pull/97
|
||||
[#101]: https://github.com/json5/json5/pull/101
|
||||
[#108]: https://github.com/json5/json5/pull/108
|
||||
[#134]: https://github.com/json5/json5/pull/134
|
||||
[#154]: https://github.com/json5/json5/issues/154
|
23
web/node_modules/mini-css-extract-plugin/node_modules/json5/LICENSE.md
generated
vendored
Normal file
23
web/node_modules/mini-css-extract-plugin/node_modules/json5/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2012-2018 Aseem Kishore, and [others].
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
[others]: https://github.com/json5/json5/contributors
|
234
web/node_modules/mini-css-extract-plugin/node_modules/json5/README.md
generated
vendored
Normal file
234
web/node_modules/mini-css-extract-plugin/node_modules/json5/README.md
generated
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
# JSON5 – JSON for Humans
|
||||
|
||||
[][Build Status]
|
||||
[][Coverage
|
||||
Status]
|
||||
|
||||
The JSON5 Data Interchange Format (JSON5) is a superset of [JSON] that aims to
|
||||
alleviate some of the limitations of JSON by expanding its syntax to include
|
||||
some productions from [ECMAScript 5.1].
|
||||
|
||||
This JavaScript library is the official reference implementation for JSON5
|
||||
parsing and serialization libraries.
|
||||
|
||||
[Build Status]: https://travis-ci.org/json5/json5
|
||||
|
||||
[Coverage Status]: https://coveralls.io/github/json5/json5
|
||||
|
||||
[JSON]: https://tools.ietf.org/html/rfc7159
|
||||
|
||||
[ECMAScript 5.1]: https://www.ecma-international.org/ecma-262/5.1/
|
||||
|
||||
## Summary of Features
|
||||
The following ECMAScript 5.1 features, which are not supported in JSON, have
|
||||
been extended to JSON5.
|
||||
|
||||
### Objects
|
||||
- Object keys may be an ECMAScript 5.1 _[IdentifierName]_.
|
||||
- Objects may have a single trailing comma.
|
||||
|
||||
### Arrays
|
||||
- Arrays may have a single trailing comma.
|
||||
|
||||
### Strings
|
||||
- Strings may be single quoted.
|
||||
- Strings may span multiple lines by escaping new line characters.
|
||||
- Strings may include character escapes.
|
||||
|
||||
### Numbers
|
||||
- Numbers may be hexadecimal.
|
||||
- Numbers may have a leading or trailing decimal point.
|
||||
- Numbers may be [IEEE 754] positive infinity, negative infinity, and NaN.
|
||||
- Numbers may begin with an explicit plus sign.
|
||||
|
||||
### Comments
|
||||
- Single and multi-line comments are allowed.
|
||||
|
||||
### White Space
|
||||
- Additional white space characters are allowed.
|
||||
|
||||
[IdentifierName]: https://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
||||
|
||||
[IEEE 754]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
|
||||
|
||||
## Short Example
|
||||
```js
|
||||
{
|
||||
// comments
|
||||
unquoted: 'and you can quote me on that',
|
||||
singleQuotes: 'I can use "double quotes" here',
|
||||
lineBreaks: "Look, Mom! \
|
||||
No \\n's!",
|
||||
hexadecimal: 0xdecaf,
|
||||
leadingDecimalPoint: .8675309, andTrailing: 8675309.,
|
||||
positiveSign: +1,
|
||||
trailingComma: 'in objects', andIn: ['arrays',],
|
||||
"backwardsCompatible": "with JSON",
|
||||
}
|
||||
```
|
||||
|
||||
## Specification
|
||||
For a detailed explanation of the JSON5 format, please read the [official
|
||||
specification](https://json5.github.io/json5-spec/).
|
||||
|
||||
## Installation
|
||||
### Node.js
|
||||
```sh
|
||||
npm install json5
|
||||
```
|
||||
|
||||
```js
|
||||
const JSON5 = require('json5')
|
||||
```
|
||||
|
||||
### Browsers
|
||||
```html
|
||||
<script src="https://unpkg.com/json5@^1.0.0"></script>
|
||||
```
|
||||
|
||||
This will create a global `JSON5` variable.
|
||||
|
||||
## API
|
||||
The JSON5 API is compatible with the [JSON API].
|
||||
|
||||
[JSON API]:
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
|
||||
|
||||
### JSON5.parse()
|
||||
Parses a JSON5 string, constructing the JavaScript value or object described by
|
||||
the string. An optional reviver function can be provided to perform a
|
||||
transformation on the resulting object before it is returned.
|
||||
|
||||
#### Syntax
|
||||
JSON5.parse(text[, reviver])
|
||||
|
||||
#### Parameters
|
||||
- `text`: The string to parse as JSON5.
|
||||
- `reviver`: If a function, this prescribes how the value originally produced by
|
||||
parsing is transformed, before being returned.
|
||||
|
||||
#### Return value
|
||||
The object corresponding to the given JSON5 text.
|
||||
|
||||
### JSON5.stringify()
|
||||
Converts a JavaScript value to a JSON5 string, optionally replacing values if a
|
||||
replacer function is specified, or optionally including only the specified
|
||||
properties if a replacer array is specified.
|
||||
|
||||
#### Syntax
|
||||
JSON5.stringify(value[, replacer[, space]])
|
||||
JSON5.stringify(value[, options])
|
||||
|
||||
#### Parameters
|
||||
- `value`: The value to convert to a JSON5 string.
|
||||
- `replacer`: A function that alters the behavior of the stringification
|
||||
process, or an array of String and Number objects that serve as a whitelist
|
||||
for selecting/filtering the properties of the value object to be included in
|
||||
the JSON5 string. If this value is null or not provided, all properties of the
|
||||
object are included in the resulting JSON5 string.
|
||||
- `space`: A String or Number object that's used to insert white space into the
|
||||
output JSON5 string for readability purposes. If this is a Number, it
|
||||
indicates the number of space characters to use as white space; this number is
|
||||
capped at 10 (if it is greater, the value is just 10). Values less than 1
|
||||
indicate that no space should be used. If this is a String, the string (or the
|
||||
first 10 characters of the string, if it's longer than that) is used as white
|
||||
space. If this parameter is not provided (or is null), no white space is used.
|
||||
If white space is used, trailing commas will be used in objects and arrays.
|
||||
- `options`: An object with the following properties:
|
||||
- `replacer`: Same as the `replacer` parameter.
|
||||
- `space`: Same as the `space` parameter.
|
||||
- `quote`: A String representing the quote character to use when serializing
|
||||
strings.
|
||||
|
||||
#### Return value
|
||||
A JSON5 string representing the value.
|
||||
|
||||
### Node.js `require()` JSON5 files
|
||||
When using Node.js, you can `require()` JSON5 files by adding the following
|
||||
statement.
|
||||
|
||||
```js
|
||||
require('json5/lib/register')
|
||||
```
|
||||
|
||||
Then you can load a JSON5 file with a Node.js `require()` statement. For
|
||||
example:
|
||||
|
||||
```js
|
||||
const config = require('./config.json5')
|
||||
```
|
||||
|
||||
## CLI
|
||||
Since JSON is more widely used than JSON5, this package includes a CLI for
|
||||
converting JSON5 to JSON and for validating the syntax of JSON5 documents.
|
||||
|
||||
### Installation
|
||||
```sh
|
||||
npm install --global json5
|
||||
```
|
||||
|
||||
### Usage
|
||||
```sh
|
||||
json5 [options] <file>
|
||||
```
|
||||
|
||||
If `<file>` is not provided, then STDIN is used.
|
||||
|
||||
#### Options:
|
||||
- `-s`, `--space`: The number of spaces to indent or `t` for tabs
|
||||
- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT
|
||||
- `-v`, `--validate`: Validate JSON5 but do not output JSON
|
||||
- `-V`, `--version`: Output the version number
|
||||
- `-h`, `--help`: Output usage information
|
||||
|
||||
## Contibuting
|
||||
### Development
|
||||
```sh
|
||||
git clone https://github.com/json5/json5
|
||||
cd json5
|
||||
npm install
|
||||
```
|
||||
|
||||
When contributing code, please write relevant tests and run `npm test` and `npm
|
||||
run lint` before submitting pull requests. Please use an editor that supports
|
||||
[EditorConfig](http://editorconfig.org/).
|
||||
|
||||
### Issues
|
||||
To report bugs or request features regarding the JSON5 data format, please
|
||||
submit an issue to the [official specification
|
||||
repository](https://github.com/json5/json5-spec).
|
||||
|
||||
To report bugs or request features regarding the JavaScript implentation of
|
||||
JSON5, please submit an issue to this repository.
|
||||
|
||||
## License
|
||||
MIT. See [LICENSE.md](./LICENSE.md) for details.
|
||||
|
||||
## Credits
|
||||
[Assem Kishore](https://github.com/aseemk) founded this project.
|
||||
|
||||
[Michael Bolin](http://bolinfest.com/) independently arrived at and published
|
||||
some of these same ideas with awesome explanations and detail. Recommended
|
||||
reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)
|
||||
|
||||
[Douglas Crockford](http://www.crockford.com/) of course designed and built
|
||||
JSON, but his state machine diagrams on the [JSON website](http://json.org/), as
|
||||
cheesy as it may sound, gave us motivation and confidence that building a new
|
||||
parser to implement these ideas was within reach! The original
|
||||
implementation of JSON5 was also modeled directly off of Doug’s open-source
|
||||
[json_parse.js] parser. We’re grateful for that clean and well-documented
|
||||
code.
|
||||
|
||||
[json_parse.js]:
|
||||
https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
|
||||
[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
|
||||
supporter, contributing multiple patches and ideas.
|
||||
|
||||
[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original
|
||||
`stringify` method.
|
||||
|
||||
[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely
|
||||
with ES5, wrote the official JSON5 specification, completely rewrote the
|
||||
codebase from the ground up, and is actively maintaining this project.
|
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/dist/index.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/cli.js
generated
vendored
Executable file
2
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _path=require('path');var _path2=_interopRequireDefault(_path);var _minimist=require('minimist');var _minimist2=_interopRequireDefault(_minimist);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var argv=(0,_minimist2.default)(process.argv.slice(2),{alias:{'convert':'c','space':'s','validate':'v','out-file':'o','version':'V','help':'h'},boolean:['convert','validate','version','help'],string:['space','out-file']});if(argv.version){version()}else if(argv.help){usage()}else{var inFilename=argv._[0];var readStream=void 0;if(inFilename){readStream=_fs2.default.createReadStream(inFilename)}else{readStream=process.stdin}var json5='';readStream.on('data',function(data){json5+=data});readStream.on('end',function(){var space=void 0;if(argv.space==='t'||argv.space==='tab'){space='\t'}else{space=Number(argv.space)}var value=void 0;try{value=_2.default.parse(json5);if(!argv.validate){var json=JSON.stringify(value,null,space);var writeStream=void 0;if(argv.convert&&inFilename&&!argv.o){var parsedFilename=_path2.default.parse(inFilename);var outFilename=_path2.default.format(Object.assign(parsedFilename,{base:_path2.default.basename(parsedFilename.base,parsedFilename.ext)+'.json'}));writeStream=_fs2.default.createWriteStream(outFilename)}else if(argv.o){writeStream=_fs2.default.createWriteStream(argv.o)}else{writeStream=process.stdout}writeStream.write(json)}}catch(err){console.error(err.message);process.exit(1)}})}function version(){console.log(_package2.default.version)}function usage(){console.log('\n Usage: json5 [options] <file>\n\n If <file> is not provided, then STDIN is used.\n\n Options:\n\n -s, --space The number of spaces to indent or \'t\' for tabs\n -o, --out-file [file] Output to the specified file, otherwise STDOUT\n -v, --validate Validate JSON5 but do not output JSON\n -V, --version Output the version number\n -h, --help Output usage information')}
|
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/index.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _parse=require('./parse');var _parse2=_interopRequireDefault(_parse);var _stringify=require('./stringify');var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default'];
|
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/parse.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/parse.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/register.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/register.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}require.extensions['.json5']=function(module,filename){var content=_fs2.default.readFileSync(filename,'utf8');try{module.exports=_2.default.parse(content)}catch(err){err.message=filename+': '+err.message;throw err}};
|
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/require.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/require.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
"use strict";require("./register");console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.");
|
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/util.js
generated
vendored
Normal file
1
web/node_modules/mini-css-extract-plugin/node_modules/json5/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var _unicode=require('../lib/unicode');var unicode=_interopRequireWildcard(_unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)}
|
76
web/node_modules/mini-css-extract-plugin/node_modules/json5/package.json
generated
vendored
Normal file
76
web/node_modules/mini-css-extract-plugin/node_modules/json5/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "json5",
|
||||
"version": "1.0.1",
|
||||
"description": "JSON for humans.",
|
||||
"main": "lib/index.js",
|
||||
"bin": "lib/cli.js",
|
||||
"browser": "dist/index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"dist/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "babel-node build/build.js && babel src -d lib && rollup -c",
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"lint": "eslint --fix build src",
|
||||
"prepublishOnly": "npm run lint && npm test && npm run production",
|
||||
"pretest": "cross-env NODE_ENV=test npm run build",
|
||||
"preversion": "npm run lint && npm test && npm run production",
|
||||
"production": "cross-env NODE_ENV=production npm run build",
|
||||
"test": "nyc --reporter=html --reporter=text mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/json5/json5.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"json5",
|
||||
"es5",
|
||||
"es2015",
|
||||
"ecmascript"
|
||||
],
|
||||
"author": "Aseem Kishore <aseem.kishore@gmail.com>",
|
||||
"contributors": [
|
||||
"Max Nanasy <max.nanasy@gmail.com>",
|
||||
"Andrew Eisenberg <andrew@eisenberg.as>",
|
||||
"Jordan Tucker <jordanbtucker@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/json5/json5/issues"
|
||||
},
|
||||
"homepage": "http://json5.org/",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-register": "^6.26.0",
|
||||
"babelrc-rollup": "^3.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"cross-env": "^5.1.4",
|
||||
"del": "^3.0.0",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-promise": "^3.7.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^5.0.4",
|
||||
"nyc": "^11.4.1",
|
||||
"regenerate": "^1.3.3",
|
||||
"rollup": "^0.56.5",
|
||||
"rollup-plugin-babel": "^3.0.3",
|
||||
"rollup-plugin-commonjs": "^9.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.2.0",
|
||||
"rollup-plugin-uglify": "^3.0.0",
|
||||
"sinon": "^4.4.2",
|
||||
"unicode-9.0.0": "^0.7.5"
|
||||
}
|
||||
}
|
87
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
87
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/webpack/loader-utils/compare/v1.3.0...v1.4.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* the `resourceQuery` is passed to the `interpolateName` method ([#163](https://github.com/webpack/loader-utils/issues/163)) ([cd0e428](https://github.com/webpack/loader-utils/commit/cd0e428))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.3.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support the `[query]` template for the `interpolatedName` method ([#162](https://github.com/webpack/loader-utils/issues/162)) ([469eeba](https://github.com/webpack/loader-utils/commit/469eeba))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.3"></a>
|
||||
## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.2"></a>
|
||||
## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed a hash type extracting in interpolateName ([#137](https://github.com/webpack/loader-utils/issues/137)) ([f8a71f4](https://github.com/webpack/loader-utils/commit/f8a71f4))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **isUrlRequest:** better handle absolute urls and non standards ([#134](https://github.com/webpack/loader-utils/issues/134)) ([aca43da](https://github.com/webpack/loader-utils/commit/aca43da))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* PR [#79](https://github.com/webpack/loader-utils/issues/79) ([#135](https://github.com/webpack/loader-utils/issues/135)) ([73d350a](https://github.com/webpack/loader-utils/commit/73d350a))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/webpack/loader-utils/compare/v1.1.0...v1.2.0) (2018-12-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **interpolateName:** support `[contenthash]`
|
||||
|
||||
### Fixes
|
||||
|
||||
* **urlToRequest:** empty urls are not rewritten to relative requests
|
||||
* **urlToRequest:** don't rewrite absolute urls
|
||||
* **isUrlRequest:** ignore all url with `extension` (like `moz-extension:`, `ms-browser-extension:` and etc)
|
||||
* **isUrlRequest:** ignore `about:blank`
|
||||
* **interpolateName:** failing explicitly when ran out of emoji
|
||||
* **interpolateName:** `[hash]` token regex in interpolate string to capture any hash algorithm name
|
||||
* **interpolateName:** parse string for emoji count before use
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
|
||||
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
|
20
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
275
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/README.md
generated
vendored
Normal file
275
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/README.md
generated
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
# loader-utils
|
||||
|
||||
## Methods
|
||||
|
||||
### `getOptions`
|
||||
|
||||
Recommended way to retrieve the options of a loader invocation:
|
||||
|
||||
```javascript
|
||||
// inside your loader
|
||||
const options = loaderUtils.getOptions(this);
|
||||
```
|
||||
|
||||
1. If `this.query` is a string:
|
||||
- Tries to parse the query string and returns a new object
|
||||
- Throws if it's not a valid query string
|
||||
2. If `this.query` is object-like, it just returns `this.query`
|
||||
3. In any other case, it just returns `null`
|
||||
|
||||
**Please note:** The returned `options` object is *read-only*. It may be re-used across multiple invocations.
|
||||
If you pass it on to another library, make sure to make a *deep copy* of it:
|
||||
|
||||
```javascript
|
||||
const options = Object.assign(
|
||||
{},
|
||||
defaultOptions,
|
||||
loaderUtils.getOptions(this) // it is safe to pass null to Object.assign()
|
||||
);
|
||||
// don't forget nested objects or arrays
|
||||
options.obj = Object.assign({}, options.obj);
|
||||
options.arr = options.arr.slice();
|
||||
someLibrary(options);
|
||||
```
|
||||
|
||||
[clone](https://www.npmjs.com/package/clone) is a good library to make a deep copy of the options.
|
||||
|
||||
#### Options as query strings
|
||||
|
||||
If the loader options have been passed as loader query string (`loader?some¶ms`), the string is parsed by using [`parseQuery`](#parsequery).
|
||||
|
||||
### `parseQuery`
|
||||
|
||||
Parses a passed string (e.g. `loaderContext.resourceQuery`) as a query string, and returns an object.
|
||||
|
||||
``` javascript
|
||||
const params = loaderUtils.parseQuery(this.resourceQuery); // resource: `file?param1=foo`
|
||||
if (params.param1 === "foo") {
|
||||
// do something
|
||||
}
|
||||
```
|
||||
|
||||
The string is parsed like this:
|
||||
|
||||
``` text
|
||||
-> Error
|
||||
? -> {}
|
||||
?flag -> { flag: true }
|
||||
?+flag -> { flag: true }
|
||||
?-flag -> { flag: false }
|
||||
?xyz=test -> { xyz: "test" }
|
||||
?xyz=1 -> { xyz: "1" } // numbers are NOT parsed
|
||||
?xyz[]=a -> { xyz: ["a"] }
|
||||
?flag1&flag2 -> { flag1: true, flag2: true }
|
||||
?+flag1,-flag2 -> { flag1: true, flag2: false }
|
||||
?xyz[]=a,xyz[]=b -> { xyz: ["a", "b"] }
|
||||
?a%2C%26b=c%2C%26d -> { "a,&b": "c,&d" }
|
||||
?{data:{a:1},isJSON5:true} -> { data: { a: 1 }, isJSON5: true }
|
||||
```
|
||||
|
||||
### `stringifyRequest`
|
||||
|
||||
Turns a request into a string that can be used inside `require()` or `import` while avoiding absolute paths.
|
||||
Use it instead of `JSON.stringify(...)` if you're generating code inside a loader.
|
||||
|
||||
**Why is this necessary?** Since webpack calculates the hash before module paths are translated into module ids, we must avoid absolute paths to ensure
|
||||
consistent hashes across different compilations.
|
||||
|
||||
This function:
|
||||
|
||||
- resolves absolute requests into relative requests if the request and the module are on the same hard drive
|
||||
- replaces `\` with `/` if the request and the module are on the same hard drive
|
||||
- won't change the path at all if the request and the module are on different hard drives
|
||||
- applies `JSON.stringify` to the result
|
||||
|
||||
```javascript
|
||||
loaderUtils.stringifyRequest(this, "./test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, ".\\test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test");
|
||||
// "\"test\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test/lib/index.js");
|
||||
// "\"test/lib/index.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "otherLoader?andConfig!test?someConfig");
|
||||
// "\"otherLoader?andConfig!test?someConfig\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, require.resolve("test"));
|
||||
// "\"../node_modules/some-loader/lib/test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"../../test.js\"" (on Windows, in case the module and the request are on the same drive)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"C:\\module\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "\\\\network-drive\\test.js");
|
||||
// "\"\\\\network-drive\\\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
```
|
||||
|
||||
### `urlToRequest`
|
||||
|
||||
Converts some resource URL to a webpack module request.
|
||||
|
||||
> i Before call `urlToRequest` you need call `isUrlRequest` to ensure it is requestable url
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
|
||||
if (loaderUtils.isUrlRequest(url)) {
|
||||
// Logic for requestable url
|
||||
const request = loaderUtils.urlToRequest(url);
|
||||
} else {
|
||||
// Logic for not requestable url
|
||||
}
|
||||
```
|
||||
|
||||
Simple example:
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "./path/to/module.js"
|
||||
```
|
||||
|
||||
#### Module URLs
|
||||
|
||||
Any URL containing a `~` will be interpreted as a module request. Anything after the `~` will be considered the request path.
|
||||
|
||||
```javascript
|
||||
const url = "~path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "path/to/module.js"
|
||||
```
|
||||
|
||||
#### Root-relative URLs
|
||||
|
||||
URLs that are root-relative (start with `/`) can be resolved relative to some arbitrary path by using the `root` parameter:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "./root";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "./root/path/to/module.js"
|
||||
```
|
||||
|
||||
To convert a root-relative URL into a module URL, specify a `root` value that starts with `~`:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "~";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "path/to/module.js"
|
||||
```
|
||||
|
||||
### `interpolateName`
|
||||
|
||||
Interpolates a filename template using multiple placeholders and/or a regular expression.
|
||||
The template and regular expression are set as query params called `name` and `regExp` on the current loader's context.
|
||||
|
||||
```javascript
|
||||
const interpolatedName = loaderUtils.interpolateName(loaderContext, name, options);
|
||||
```
|
||||
|
||||
The following tokens are replaced in the `name` parameter:
|
||||
|
||||
* `[ext]` the extension of the resource
|
||||
* `[name]` the basename of the resource
|
||||
* `[path]` the path of the resource relative to the `context` query parameter or option.
|
||||
* `[folder]` the folder the resource is in
|
||||
* `[query]` the queryof the resource, i.e. `?foo=bar`
|
||||
* `[emoji]` a random emoji representation of `options.content`
|
||||
* `[emoji:<length>]` same as above, but with a customizable number of emojis
|
||||
* `[contenthash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:contenthash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[hash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:hash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[N]` the N-th match obtained from matching the current file name against `options.regExp`
|
||||
|
||||
In loader context `[hash]` and `[contenthash]` are the same, but we recommend using `[contenthash]` for avoid misleading.
|
||||
|
||||
Examples
|
||||
|
||||
``` javascript
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext][query]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js?foo=bar
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[contenthash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/page.html"
|
||||
loaderUtils.interpolateName(loaderContext, "html-[hash:6].html", { content: ... });
|
||||
// => html-9473fd.html
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/flash.txt"
|
||||
loaderUtils.interpolateName(loaderContext, "[hash]", { content: ... });
|
||||
// => c31e9820c001c9c4a86bce33ce43b679
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji]", { content: ... });
|
||||
// => 👍
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji:4]", { content: ... });
|
||||
// => 🙍🏢📤🐝
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[sha512:hash:base64:7].[ext]", { content: ... });
|
||||
// => 2BKDTjl.png
|
||||
// use sha512 hash instead of md5 and with only 7 chars of base64
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/myself.png"
|
||||
// loaderContext.query.name =
|
||||
loaderUtils.interpolateName(loaderContext, "picture.png");
|
||||
// => picture.png
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/dir/file.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[path][name].[ext]?[hash]", { content: ... });
|
||||
// => /app/dir/file.png?9473fdd0d880a43c21b7778d34872157
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/page-home.js"
|
||||
loaderUtils.interpolateName(loaderContext, "script-[1].[ext]", { regExp: "page-(.*)\\.js", content: ... });
|
||||
// => script-home.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(
|
||||
loaderContext,
|
||||
(resourcePath, resourceQuery) => {
|
||||
// resourcePath - `/app/js/javascript.js`
|
||||
// resourceQuery - `?foo=bar`
|
||||
|
||||
return "js/[hash].script.[ext]";
|
||||
},
|
||||
{ content: ... }
|
||||
);
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
```
|
||||
|
||||
### `getHashDigest`
|
||||
|
||||
``` javascript
|
||||
const digestString = loaderUtils.getHashDigest(buffer, hashType, digestType, maxLength);
|
||||
```
|
||||
|
||||
* `buffer` the content that should be hashed
|
||||
* `hashType` one of `sha1`, `md5`, `sha256`, `sha512` or any other node.js supported hash type
|
||||
* `digestType` one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* `maxLength` the maximum length in chars
|
||||
|
||||
## License
|
||||
|
||||
MIT (http://www.opensource.org/licenses/mit-license.php)
|
16
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
16
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getCurrentRequest(loaderContext) {
|
||||
if (loaderContext.currentRequest) {
|
||||
return loaderContext.currentRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getCurrentRequest;
|
69
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
69
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
const baseEncodeTables = {
|
||||
26: 'abcdefghijklmnopqrstuvwxyz',
|
||||
32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
|
||||
36: '0123456789abcdefghijklmnopqrstuvwxyz',
|
||||
49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
|
||||
52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
|
||||
62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
|
||||
};
|
||||
|
||||
function encodeBufferToBase(buffer, base) {
|
||||
const encodeTable = baseEncodeTables[base];
|
||||
if (!encodeTable) {
|
||||
throw new Error('Unknown encoding base' + base);
|
||||
}
|
||||
|
||||
const readLength = buffer.length;
|
||||
const Big = require('big.js');
|
||||
|
||||
Big.RM = Big.DP = 0;
|
||||
let b = new Big(0);
|
||||
|
||||
for (let i = readLength - 1; i >= 0; i--) {
|
||||
b = b.times(256).plus(buffer[i]);
|
||||
}
|
||||
|
||||
let output = '';
|
||||
while (b.gt(0)) {
|
||||
output = encodeTable[b.mod(base)] + output;
|
||||
b = b.div(base);
|
||||
}
|
||||
|
||||
Big.DP = 20;
|
||||
Big.RM = 1;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function getHashDigest(buffer, hashType, digestType, maxLength) {
|
||||
hashType = hashType || 'md5';
|
||||
maxLength = maxLength || 9999;
|
||||
|
||||
const hash = require('crypto').createHash(hashType);
|
||||
|
||||
hash.update(buffer);
|
||||
|
||||
if (
|
||||
digestType === 'base26' ||
|
||||
digestType === 'base32' ||
|
||||
digestType === 'base36' ||
|
||||
digestType === 'base49' ||
|
||||
digestType === 'base52' ||
|
||||
digestType === 'base58' ||
|
||||
digestType === 'base62' ||
|
||||
digestType === 'base64'
|
||||
) {
|
||||
return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
|
||||
0,
|
||||
maxLength
|
||||
);
|
||||
} else {
|
||||
return hash.digest(digestType || 'hex').substr(0, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = getHashDigest;
|
20
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
20
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const parseQuery = require('./parseQuery');
|
||||
|
||||
function getOptions(loaderContext) {
|
||||
const query = loaderContext.query;
|
||||
|
||||
if (typeof query === 'string' && query !== '') {
|
||||
return parseQuery(loaderContext.query);
|
||||
}
|
||||
|
||||
if (!query || typeof query !== 'object') {
|
||||
// Not object-like queries are not supported.
|
||||
return null;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
module.exports = getOptions;
|
16
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
16
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getRemainingRequest(loaderContext) {
|
||||
if (loaderContext.remainingRequest) {
|
||||
return loaderContext.remainingRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex + 1)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getRemainingRequest;
|
23
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
23
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
const getOptions = require('./getOptions');
|
||||
const parseQuery = require('./parseQuery');
|
||||
const stringifyRequest = require('./stringifyRequest');
|
||||
const getRemainingRequest = require('./getRemainingRequest');
|
||||
const getCurrentRequest = require('./getCurrentRequest');
|
||||
const isUrlRequest = require('./isUrlRequest');
|
||||
const urlToRequest = require('./urlToRequest');
|
||||
const parseString = require('./parseString');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
const interpolateName = require('./interpolateName');
|
||||
|
||||
exports.getOptions = getOptions;
|
||||
exports.parseQuery = parseQuery;
|
||||
exports.stringifyRequest = stringifyRequest;
|
||||
exports.getRemainingRequest = getRemainingRequest;
|
||||
exports.getCurrentRequest = getCurrentRequest;
|
||||
exports.isUrlRequest = isUrlRequest;
|
||||
exports.urlToRequest = urlToRequest;
|
||||
exports.parseString = parseString;
|
||||
exports.getHashDigest = getHashDigest;
|
||||
exports.interpolateName = interpolateName;
|
151
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
151
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const emojisList = require('emojis-list');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
|
||||
const emojiRegex = /[\uD800-\uDFFF]./;
|
||||
const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
|
||||
const emojiCache = {};
|
||||
|
||||
function encodeStringToEmoji(content, length) {
|
||||
if (emojiCache[content]) {
|
||||
return emojiCache[content];
|
||||
}
|
||||
|
||||
length = length || 1;
|
||||
|
||||
const emojis = [];
|
||||
|
||||
do {
|
||||
if (!emojiList.length) {
|
||||
throw new Error('Ran out of emoji');
|
||||
}
|
||||
|
||||
const index = Math.floor(Math.random() * emojiList.length);
|
||||
|
||||
emojis.push(emojiList[index]);
|
||||
emojiList.splice(index, 1);
|
||||
} while (--length > 0);
|
||||
|
||||
const emojiEncoding = emojis.join('');
|
||||
|
||||
emojiCache[content] = emojiEncoding;
|
||||
|
||||
return emojiEncoding;
|
||||
}
|
||||
|
||||
function interpolateName(loaderContext, name, options) {
|
||||
let filename;
|
||||
|
||||
const hasQuery =
|
||||
loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
|
||||
|
||||
if (typeof name === 'function') {
|
||||
filename = name(
|
||||
loaderContext.resourcePath,
|
||||
hasQuery ? loaderContext.resourceQuery : undefined
|
||||
);
|
||||
} else {
|
||||
filename = name || '[hash].[ext]';
|
||||
}
|
||||
|
||||
const context = options.context;
|
||||
const content = options.content;
|
||||
const regExp = options.regExp;
|
||||
|
||||
let ext = 'bin';
|
||||
let basename = 'file';
|
||||
let directory = '';
|
||||
let folder = '';
|
||||
let query = '';
|
||||
|
||||
if (loaderContext.resourcePath) {
|
||||
const parsed = path.parse(loaderContext.resourcePath);
|
||||
let resourcePath = loaderContext.resourcePath;
|
||||
|
||||
if (parsed.ext) {
|
||||
ext = parsed.ext.substr(1);
|
||||
}
|
||||
|
||||
if (parsed.dir) {
|
||||
basename = parsed.name;
|
||||
resourcePath = parsed.dir + path.sep;
|
||||
}
|
||||
|
||||
if (typeof context !== 'undefined') {
|
||||
directory = path
|
||||
.relative(context, resourcePath + '_')
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/\.\.(\/)?/g, '_$1');
|
||||
directory = directory.substr(0, directory.length - 1);
|
||||
} else {
|
||||
directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
|
||||
}
|
||||
|
||||
if (directory.length === 1) {
|
||||
directory = '';
|
||||
} else if (directory.length > 1) {
|
||||
folder = path.basename(directory);
|
||||
}
|
||||
}
|
||||
|
||||
if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
|
||||
query = loaderContext.resourceQuery;
|
||||
|
||||
const hashIdx = query.indexOf('#');
|
||||
|
||||
if (hashIdx >= 0) {
|
||||
query = query.substr(0, hashIdx);
|
||||
}
|
||||
}
|
||||
|
||||
let url = filename;
|
||||
|
||||
if (content) {
|
||||
// Match hash template
|
||||
url = url
|
||||
// `hash` and `contenthash` are same in `loader-utils` context
|
||||
// let's keep `hash` for backward compatibility
|
||||
.replace(
|
||||
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
|
||||
(all, hashType, digestType, maxLength) =>
|
||||
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
|
||||
)
|
||||
.replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
|
||||
encodeStringToEmoji(content, parseInt(length, 10))
|
||||
);
|
||||
}
|
||||
|
||||
url = url
|
||||
.replace(/\[ext\]/gi, () => ext)
|
||||
.replace(/\[name\]/gi, () => basename)
|
||||
.replace(/\[path\]/gi, () => directory)
|
||||
.replace(/\[folder\]/gi, () => folder)
|
||||
.replace(/\[query\]/gi, () => query);
|
||||
|
||||
if (regExp && loaderContext.resourcePath) {
|
||||
const match = loaderContext.resourcePath.match(new RegExp(regExp));
|
||||
|
||||
match &&
|
||||
match.forEach((matched, i) => {
|
||||
url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
typeof loaderContext.options === 'object' &&
|
||||
typeof loaderContext.options.customInterpolateName === 'function'
|
||||
) {
|
||||
url = loaderContext.options.customInterpolateName.call(
|
||||
loaderContext,
|
||||
url,
|
||||
name,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = interpolateName;
|
31
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
31
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
function isUrlRequest(url, root) {
|
||||
// An URL is not an request if
|
||||
|
||||
// 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path.win32.isAbsolute(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. It's a protocol-relative
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. It's some kind of url for a template
|
||||
if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. It's also not an request if root isn't set and it's a root-relative url
|
||||
if ((root === undefined || root === false) && /^\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isUrlRequest;
|
68
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
68
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
'use strict';
|
||||
|
||||
const JSON5 = require('json5');
|
||||
|
||||
const specialValues = {
|
||||
null: null,
|
||||
true: true,
|
||||
false: false,
|
||||
};
|
||||
|
||||
function parseQuery(query) {
|
||||
if (query.substr(0, 1) !== '?') {
|
||||
throw new Error(
|
||||
"A valid query string passed to parseQuery should begin with '?'"
|
||||
);
|
||||
}
|
||||
|
||||
query = query.substr(1);
|
||||
|
||||
if (!query) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
|
||||
return JSON5.parse(query);
|
||||
}
|
||||
|
||||
const queryArgs = query.split(/[,&]/g);
|
||||
const result = {};
|
||||
|
||||
queryArgs.forEach((arg) => {
|
||||
const idx = arg.indexOf('=');
|
||||
|
||||
if (idx >= 0) {
|
||||
let name = arg.substr(0, idx);
|
||||
let value = decodeURIComponent(arg.substr(idx + 1));
|
||||
|
||||
if (specialValues.hasOwnProperty(value)) {
|
||||
value = specialValues[value];
|
||||
}
|
||||
|
||||
if (name.substr(-2) === '[]') {
|
||||
name = decodeURIComponent(name.substr(0, name.length - 2));
|
||||
|
||||
if (!Array.isArray(result[name])) {
|
||||
result[name] = [];
|
||||
}
|
||||
|
||||
result[name].push(value);
|
||||
} else {
|
||||
name = decodeURIComponent(name);
|
||||
result[name] = value;
|
||||
}
|
||||
} else {
|
||||
if (arg.substr(0, 1) === '-') {
|
||||
result[decodeURIComponent(arg.substr(1))] = false;
|
||||
} else if (arg.substr(0, 1) === '+') {
|
||||
result[decodeURIComponent(arg.substr(1))] = true;
|
||||
} else {
|
||||
result[decodeURIComponent(arg)] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = parseQuery;
|
23
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
23
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
function parseString(str) {
|
||||
try {
|
||||
if (str[0] === '"') {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
if (str[0] === "'" && str.substr(str.length - 1) === "'") {
|
||||
return parseString(
|
||||
str
|
||||
.replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
|
||||
.replace(/^'|'$/g, '"')
|
||||
);
|
||||
}
|
||||
|
||||
return JSON.parse('"' + str + '"');
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parseString;
|
51
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
51
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const matchRelativePath = /^\.\.?[/\\]/;
|
||||
|
||||
function isAbsolutePath(str) {
|
||||
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
|
||||
}
|
||||
|
||||
function isRelativePath(str) {
|
||||
return matchRelativePath.test(str);
|
||||
}
|
||||
|
||||
function stringifyRequest(loaderContext, request) {
|
||||
const splitted = request.split('!');
|
||||
const context =
|
||||
loaderContext.context ||
|
||||
(loaderContext.options && loaderContext.options.context);
|
||||
|
||||
return JSON.stringify(
|
||||
splitted
|
||||
.map((part) => {
|
||||
// First, separate singlePath from query, because the query might contain paths again
|
||||
const splittedPart = part.match(/^(.*?)(\?.*)/);
|
||||
const query = splittedPart ? splittedPart[2] : '';
|
||||
let singlePath = splittedPart ? splittedPart[1] : part;
|
||||
|
||||
if (isAbsolutePath(singlePath) && context) {
|
||||
singlePath = path.relative(context, singlePath);
|
||||
|
||||
if (isAbsolutePath(singlePath)) {
|
||||
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
||||
// In this case, we leave the path platform-specific without replacing any separators.
|
||||
// @see https://github.com/webpack/loader-utils/pull/14
|
||||
return singlePath + query;
|
||||
}
|
||||
|
||||
if (isRelativePath(singlePath) === false) {
|
||||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
|
||||
singlePath = './' + singlePath;
|
||||
}
|
||||
}
|
||||
|
||||
return singlePath.replace(/\\/g, '/') + query;
|
||||
})
|
||||
.join('!')
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = stringifyRequest;
|
60
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
60
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
// we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
|
||||
function urlToRequest(url, root) {
|
||||
// Do not rewrite an empty url
|
||||
if (url === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
const moduleRequestRegex = /^[^?]*~/;
|
||||
let request;
|
||||
|
||||
if (matchNativeWin32Path.test(url)) {
|
||||
// absolute windows path, keep it
|
||||
request = url;
|
||||
} else if (root !== undefined && root !== false && /^\//.test(url)) {
|
||||
// if root is set and the url is root-relative
|
||||
switch (typeof root) {
|
||||
// 1. root is a string: root is prefixed to the url
|
||||
case 'string':
|
||||
// special case: `~` roots convert to module request
|
||||
if (moduleRequestRegex.test(root)) {
|
||||
request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
|
||||
} else {
|
||||
request = root + url;
|
||||
}
|
||||
break;
|
||||
// 2. root is `true`: absolute paths are allowed
|
||||
// *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
|
||||
case 'boolean':
|
||||
request = url;
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
"Unexpected parameters to loader-utils 'urlToRequest': url = " +
|
||||
url +
|
||||
', root = ' +
|
||||
root +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
} else if (/^\.\.?\//.test(url)) {
|
||||
// A relative url stays
|
||||
request = url;
|
||||
} else {
|
||||
// every other url is threaded like a relative url
|
||||
request = './' + url;
|
||||
}
|
||||
|
||||
// A `~` makes the url an module
|
||||
if (moduleRequestRegex.test(request)) {
|
||||
request = request.replace(moduleRequestRegex, '');
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = urlToRequest;
|
39
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/package.json
generated
vendored
Normal file
39
web/node_modules/mini-css-extract-plugin/node_modules/loader-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "loader-utils",
|
||||
"version": "1.4.0",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"description": "utils for webpack loaders",
|
||||
"dependencies": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"pretest": "yarn lint",
|
||||
"test": "jest",
|
||||
"test:ci": "jest --coverage",
|
||||
"release": "yarn test && standard-version"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webpack/loader-utils.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.2",
|
||||
"eslint": "^5.11.0",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"jest": "^21.2.1",
|
||||
"prettier": "^1.19.1",
|
||||
"standard-version": "^4.0.0"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
}
|
134
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
134
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
|
@ -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
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
149
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/README.md
generated
vendored
Normal file
149
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/README.md
generated
vendored
Normal file
|
@ -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
|
41
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/package.json
generated
vendored
Normal file
41
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "schema-utils",
|
||||
"version": "1.0.0",
|
||||
"description": "webpack Validation Utils",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --cache src test",
|
||||
"test": "jest --env node --verbose --coverage",
|
||||
"clean": "del-cli coverage",
|
||||
"commits": "commitlint --from $(git rev-list --tags --max-count=1)",
|
||||
"release": "npm run commits && standard-version"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.1.0",
|
||||
"ajv-errors": "^1.0.0",
|
||||
"ajv-keywords": "^3.1.0"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"author": "webpack Contrib (https://github.com/webpack-contrib)",
|
||||
"bugs": "https://github.com/webpack-contrib/schema-utils/issues",
|
||||
"homepage": "https://github.com/webpack-contrib/schema-utils",
|
||||
"repository": "https://github.com/webpack-contrib/schema-utils",
|
||||
"license": "MIT"
|
||||
}
|
30
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/ValidationError.js
generated
vendored
Normal file
30
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/ValidationError.js
generated
vendored
Normal file
|
@ -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;
|
9
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/index.js
generated
vendored
Normal file
9
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* eslint-disable
|
||||
strict
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const validateOptions = require('./validateOptions');
|
||||
|
||||
module.exports = validateOptions;
|
38
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/validateOptions.js
generated
vendored
Normal file
38
web/node_modules/mini-css-extract-plugin/node_modules/schema-utils/src/validateOptions.js
generated
vendored
Normal file
|
@ -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;
|
87
web/node_modules/mini-css-extract-plugin/package.json
generated
vendored
Normal file
87
web/node_modules/mini-css-extract-plugin/package.json
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
"name": "mini-css-extract-plugin",
|
||||
"version": "0.11.3",
|
||||
"description": "extracts CSS into separate files",
|
||||
"license": "MIT",
|
||||
"repository": "webpack-contrib/mini-css-extract-plugin",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"homepage": "https://github.com/webpack-contrib/mini-css-extract-plugin",
|
||||
"bugs": "https://github.com/webpack-contrib/mini-css-extract-plugin/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/cjs.js",
|
||||
"engines": {
|
||||
"node": ">= 6.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"prebuild": "npm run clean",
|
||||
"build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files",
|
||||
"postbuild": "es-check es5 dist/hmr/hotModuleReplacement.js",
|
||||
"clean": "del-cli dist",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint": "npm-run-all -l -p \"lint:**\"",
|
||||
"prepare": "npm run build",
|
||||
"release": "standard-version",
|
||||
"security": "npm audit",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"test:manual": "npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
|
||||
"pretest": "npm run lint",
|
||||
"test": "cross-env NODE_ENV=test npm run test:coverage",
|
||||
"defaults": "webpack-defaults"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"webpack": "^4.4.0 || ^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"loader-utils": "^1.1.0",
|
||||
"normalize-url": "1.9.1",
|
||||
"schema-utils": "^1.0.0",
|
||||
"webpack-sources": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@commitlint/cli": "^11.0.0",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"@webpack-contrib/defaults": "^6.3.0",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-eslint": "^10.0.2",
|
||||
"babel-jest": "^26.3.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^4.3.0",
|
||||
"del": "^5.1.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"es-check": "^5.0.0",
|
||||
"eslint": "^7.8.1",
|
||||
"eslint-config-prettier": "^6.0.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"file-loader": "^6.1.0",
|
||||
"husky": "^4.3.0",
|
||||
"jest": "^24.9.0",
|
||||
"lint-staged": "^10.3.0",
|
||||
"memfs": "^3.0.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"standard-version": "^9.0.0",
|
||||
"webpack": "^4.44.1",
|
||||
"webpack-cli": "^3.3.6",
|
||||
"webpack-dev-server": "^3.7.2"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"css",
|
||||
"extract",
|
||||
"hmr"
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue