mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
324
web/node_modules/postcss-loader/CHANGELOG.md
generated
vendored
Normal file
324
web/node_modules/postcss-loader/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,324 @@
|
|||
# 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="3.0.0"></a>
|
||||
# [3.0.0](https://github.com/postcss/postcss-loader/compare/v2.1.6...v3.0.0) (2018-08-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** add ast version (`meta.ast`) ([f34954f](https://github.com/postcss/postcss-loader/commit/f34954f))
|
||||
* **index:** emit `warnings` as an instance of `{Error}` ([8ac6fb5](https://github.com/postcss/postcss-loader/commit/8ac6fb5))
|
||||
* **options:** improved `ValidationError` messages ([549ea08](https://github.com/postcss/postcss-loader/commit/549ea08))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **package:** update `postcss` v6.0.0...7.0.0 (`dependencies`) ([#375](https://github.com/postcss/postcss-loader/issues/375)) ([daa0da8](https://github.com/postcss/postcss-loader/commit/daa0da8))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **package:** requires `node >= v6.0.0`
|
||||
|
||||
|
||||
|
||||
<a name="2.1.6"></a>
|
||||
## [2.1.6](https://github.com/postcss/postcss-loader/compare/v2.1.5...v2.1.6) (2018-07-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** config memory leak, updates `postcss-load-config` v1.2.0...2.0.0 (`dependencies`) ([0547b12](https://github.com/postcss/postcss-loader/commit/0547b12))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.5"></a>
|
||||
## [2.1.5](https://github.com/postcss/postcss-loader/compare/v2.1.4...v2.1.5) (2018-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** remove `sourceMap` warning ([#361](https://github.com/postcss/postcss-loader/issues/361)) ([4416791](https://github.com/postcss/postcss-loader/commit/4416791))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.4"></a>
|
||||
## [2.1.4](https://github.com/postcss/postcss-loader/compare/v2.1.3...v2.1.4) (2018-04-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* restore loader object in postcss config context ([#355](https://github.com/postcss/postcss-loader/issues/355)) ([2ff1735](https://github.com/postcss/postcss-loader/commit/2ff1735))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.3"></a>
|
||||
## [2.1.3](https://github.com/postcss/postcss-loader/compare/v2.1.2...v2.1.3) (2018-03-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **options:** revert additionalProperties changes to keep SemVer ([bd7fc38](https://github.com/postcss/postcss-loader/commit/bd7fc38))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.2"></a>
|
||||
## [2.1.2](https://github.com/postcss/postcss-loader/compare/v2.1.1...v2.1.2) (2018-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **options:** disallow additional properties and add `ident` to validation ([#346](https://github.com/postcss/postcss-loader/issues/346)) ([82ef553](https://github.com/postcss/postcss-loader/commit/82ef553))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.1"></a>
|
||||
## [2.1.1](https://github.com/postcss/postcss-loader/compare/v2.1.0...v2.1.1) (2018-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** don't set `to` value (`options`) ([#339](https://github.com/postcss/postcss-loader/issues/339)) ([cdbb8b6](https://github.com/postcss/postcss-loader/commit/cdbb8b6))
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/postcss/postcss-loader/compare/v2.0.10...v2.1.0) (2018-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** continue watching after dependency `{Error}` ([#332](https://github.com/postcss/postcss-loader/issues/332)) ([a8921cc](https://github.com/postcss/postcss-loader/commit/a8921cc))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **index:** pass AST (`result.root`) && Messages (`result.messages`) as metadata to other loaders ([#322](https://github.com/postcss/postcss-loader/issues/322)) ([56232e7](https://github.com/postcss/postcss-loader/commit/56232e7))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.10"></a>
|
||||
## [2.0.10](https://github.com/postcss/postcss-loader/compare/v2.0.9...v2.0.10) (2018-01-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** copy loader `options` before modifying ([#326](https://github.com/postcss/postcss-loader/issues/326)) ([61ff03c](https://github.com/postcss/postcss-loader/commit/61ff03c))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.9"></a>
|
||||
## [2.0.9](https://github.com/postcss/postcss-loader/compare/v2.0.8...v2.0.9) (2017-11-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** filter `ident` (`options.ident`) ([#315](https://github.com/postcss/postcss-loader/issues/315)) ([3e1c7fa](https://github.com/postcss/postcss-loader/commit/3e1c7fa))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.8"></a>
|
||||
## [2.0.8](https://github.com/postcss/postcss-loader/compare/v2.0.6...v2.0.8) (2017-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lib/options:** handle `{Object}` return (`options.plugins`) ([#301](https://github.com/postcss/postcss-loader/issues/301)) ([df010a7](https://github.com/postcss/postcss-loader/commit/df010a7))
|
||||
* **schema:** allow to pass an `{Object}` (`options.syntax/options.stringifier`) ([#300](https://github.com/postcss/postcss-loader/issues/300)) ([58e9996](https://github.com/postcss/postcss-loader/commit/58e9996))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.7"></a>
|
||||
## [2.0.7](https://github.com/postcss/postcss-loader/compare/v2.0.6...v2.0.7) (2017-10-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* sanitizing `from` and `to` options (`postcss.config.js`) ([#260](https://github.com/postcss/postcss-loader/issues/260)) ([753dea7](https://github.com/postcss/postcss-loader/commit/753dea7))
|
||||
* **index:** runaway promise ([#269](https://github.com/postcss/postcss-loader/issues/269)) ([8df20ce](https://github.com/postcss/postcss-loader/commit/8df20ce))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.6"></a>
|
||||
## [2.0.6](https://github.com/postcss/postcss-loader/compare/v2.0.5...v2.0.6) (2017-06-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow to pass an `{Object}` (`options.parser`) ([#257](https://github.com/postcss/postcss-loader/issues/257)) ([4974607](https://github.com/postcss/postcss-loader/commit/4974607))
|
||||
* misspelling in warnings ([#237](https://github.com/postcss/postcss-loader/issues/237)) ([adcbb2e](https://github.com/postcss/postcss-loader/commit/adcbb2e))
|
||||
* **index:** simplify config loading behaviour ([#259](https://github.com/postcss/postcss-loader/issues/259)) ([b313478](https://github.com/postcss/postcss-loader/commit/b313478))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.5"></a>
|
||||
## [2.0.5](https://github.com/postcss/postcss-loader/compare/v2.0.4...v2.0.5) (2017-05-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* regression with `options.plugins` `{Function}` (`webpack.config.js`) (#229) ([dca52a9](https://github.com/postcss/postcss-loader/commit/dca52a9))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.4"></a>
|
||||
## [2.0.4](https://github.com/postcss/postcss-loader/compare/v2.0.3...v2.0.4) (2017-05-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** `postcss.config.js` not resolved correctly (`options.config`) ([faaeee4](https://github.com/postcss/postcss-loader/commit/faaeee4))
|
||||
* **index:** update validation schema, better warning message ([4f20c99](https://github.com/postcss/postcss-loader/commit/4f20c99))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## [2.0.3](https://github.com/postcss/postcss-loader/compare/v2.0.2...v2.0.3) (2017-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** don't fail on 'sourceMap: false' && emit a warning instead, when previous map found (`options.sourceMap`) ([159b66a](https://github.com/postcss/postcss-loader/commit/159b66a))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## [2.0.2](https://github.com/postcss/postcss-loader/compare/v2.0.1...v2.0.2) (2017-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** 'No PostCSS Config found' (`options.config`) (#215) ([e764761](https://github.com/postcss/postcss-loader/commit/e764761))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## [2.0.1](https://github.com/postcss/postcss-loader/compare/v2.0.0...v2.0.1) (2017-05-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** 'Cannot create property `prev` on boolean `false`' (`options.sourceMap`) ([c4f0064](https://github.com/postcss/postcss-loader/commit/c4f0064))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/postcss/postcss-loader/compare/1.2.2...v2.0.0) (2017-05-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **index:** add ctx, ctx.file, ctx.options ([0dceb2c](https://github.com/postcss/postcss-loader/commit/0dceb2c))
|
||||
* **index:** add options validation ([2b76df8](https://github.com/postcss/postcss-loader/commit/2b76df8))
|
||||
|
||||
|
||||
|
||||
## 1.3.3
|
||||
* Remove `postcss-loader-before-processing` warning (by Michael Ciniawsky).
|
||||
|
||||
## 1.3.2
|
||||
* Fix deprecated warning (by Xiaoyu Zhai).
|
||||
|
||||
## 1.3.1
|
||||
* Fix conflict with CLI `--config` argument (by EGOIST).
|
||||
|
||||
## 1.3
|
||||
* Allow object in syntax options, not only path for require (by Jeff Escalante).
|
||||
|
||||
## 1.2.2
|
||||
* Watch `postcss.config.js` for changes (by Michael Ciniawsky).
|
||||
|
||||
## 1.2.1
|
||||
* Fix relative `config` parameter resolving (by Simen Bekkhus).
|
||||
|
||||
## 1.2
|
||||
* Add `config` parameter (by sainthkh).
|
||||
|
||||
## 1.1.1
|
||||
* Fix `this` in options function (by Jeff Escalante).
|
||||
|
||||
## 1.1
|
||||
* PostCSS common config could be placed to subdirs.
|
||||
* Add webpack instance to PostCSS common config context.
|
||||
|
||||
## 1.0
|
||||
* Add common PostCSS config support (by Mateusz Derks).
|
||||
* Add Webpack 2 support with `plugins` query option (by Izaak Schroeder).
|
||||
* Add `dependency` message support.
|
||||
* Rewrite docs (by Michael Ciniawsky).
|
||||
|
||||
## 0.13
|
||||
* Add `exec` parameter (by Neal Granger).
|
||||
|
||||
## 0.12
|
||||
* Add CSS syntax highlight to syntax error code frame.
|
||||
|
||||
## 0.11.1
|
||||
* Fix Promise API (by Daniel Haus).
|
||||
|
||||
## 0.11
|
||||
* Add `postcss-loader-before-processing` webpack event (by Jan Nicklas).
|
||||
|
||||
## 0.10.1
|
||||
* Better syntax error message (by Andrey Popp).
|
||||
|
||||
## 0.10.0
|
||||
* Add `sourceMap` parameter to force inline maps (by 雪狼).
|
||||
|
||||
## 0.9.1
|
||||
* Fix plugin in simple array config.
|
||||
|
||||
## 0.9
|
||||
* Allow to pass syntax, parser or stringifier as function (by Jeff Escalante).
|
||||
|
||||
## 0.8.2
|
||||
* Fix source map support (by Andrew Bradley).
|
||||
|
||||
## 0.8.1
|
||||
* Fix resource path.
|
||||
|
||||
## 0.8
|
||||
* Add postcss-js support (by Simon Degraeve).
|
||||
|
||||
## 0.7
|
||||
* Added argument with webpack instance to plugins callback (by Maxime Thirouin).
|
||||
|
||||
## 0.6
|
||||
* Use PostCSS 5.0.
|
||||
* Remove `safe` parameter. Use Safe Parser.
|
||||
* Add `syntax`, `parser` and `stringifier` parameters.
|
||||
|
||||
## 0.5.1
|
||||
* Fix string source map support (by Jan Nicklas).
|
||||
|
||||
## 0.5.0
|
||||
* Set plugins by function for hot reload support (by Stefano Brilli).
|
||||
|
||||
## 0.4.4
|
||||
* Fix error on empty PostCSS config.
|
||||
|
||||
## 0.4.3
|
||||
* Better check for `CssSyntaxError`.
|
||||
|
||||
## 0.4.2
|
||||
* Fixed invalid sourcemap exception (by Richard Willis).
|
||||
|
||||
## 0.4.1
|
||||
* Use only Promise API to catch PostCSS errors.
|
||||
|
||||
## 0.4
|
||||
* Add PostCSS asynchronous API support.
|
||||
* Fix source map support (by Richard Willis).
|
||||
* Add warnings API support.
|
||||
* Better output for CSS syntax errors.
|
||||
|
||||
## 0.3
|
||||
* Use PostCSS 4.0.
|
||||
|
||||
## 0.2
|
||||
* Use PostCSS 3.0.
|
||||
|
||||
## 0.1
|
||||
* Initial release.
|
20
web/node_modules/postcss-loader/LICENSE
generated
vendored
Normal file
20
web/node_modules/postcss-loader/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
License (MIT)
|
||||
|
||||
Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
497
web/node_modules/postcss-loader/README.md
generated
vendored
Normal file
497
web/node_modules/postcss-loader/README.md
generated
vendored
Normal file
|
@ -0,0 +1,497 @@
|
|||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
|
||||
<div align="center">
|
||||
<img width="180" height="180" hspace="10"
|
||||
alt="PostCSS Logo"
|
||||
src="https://api.postcss.org/logo.svg">
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200" hspace="10"
|
||||
src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
|
||||
</a>
|
||||
<div align="center">
|
||||
<a href="https://evilmartians.com/?utm_source=postcss">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54" vspace="10">
|
||||
</a>
|
||||
</div>
|
||||
<h1>PostCSS Loader</h1>
|
||||
<p>Loader for <a href="https://webpack.js.org/">webpack</a> to process CSS with <a href="https://postcss.org/">PostCSS</a></p>
|
||||
</div>
|
||||
|
||||
<h2 align="center">Install</h2>
|
||||
|
||||
```bash
|
||||
npm i -D postcss-loader
|
||||
```
|
||||
|
||||
<h2 align="center">Usage</h2>
|
||||
|
||||
### `Configuration`
|
||||
|
||||
**`postcss.config.js`**
|
||||
```js
|
||||
module.exports = {
|
||||
parser: 'sugarss',
|
||||
plugins: {
|
||||
'postcss-import': {},
|
||||
'postcss-preset-env': {},
|
||||
'cssnano': {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can read more about common PostCSS Config [here](https://github.com/michael-ciniawsky/postcss-load-config).
|
||||
|
||||
### `Config Cascade`
|
||||
|
||||
You can use different `postcss.config.js` files in different directories.
|
||||
Config lookup starts from `path.dirname(file)` and walks the file tree upwards until a config file is found.
|
||||
|
||||
```
|
||||
|– components
|
||||
| |– component
|
||||
| | |– index.js
|
||||
| | |– index.png
|
||||
| | |– style.css (1)
|
||||
| | |– postcss.config.js (1)
|
||||
| |– component
|
||||
| | |– index.js
|
||||
| | |– image.png
|
||||
| | |– style.css (2)
|
||||
|
|
||||
|– postcss.config.js (1 && 2 (recommended))
|
||||
|– webpack.config.js
|
||||
|
|
||||
|– package.json
|
||||
```
|
||||
|
||||
After setting up your `postcss.config.js`, add `postcss-loader` to your `webpack.config.js`. You can use it standalone or in conjunction with `css-loader` (recommended). Use it **after** `css-loader` and `style-loader`, but **before** other preprocessor loaders like e.g `sass|less|stylus-loader`, if you use any.
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [ 'style-loader', 'postcss-loader' ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> ⚠️ When `postcss-loader` is used standalone (without `css-loader`) don't use `@import` in your CSS, since this can lead to quite bloated bundles
|
||||
|
||||
**`webpack.config.js` (recommended)**
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
||||
'postcss-loader'
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<h2 align="center">Options</h2>
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|[`exec`](#exec)|`{Boolean}`|`undefined`|Enable PostCSS Parser support in `CSS-in-JS`|
|
||||
|[`parser`](#syntaxes)|`{String\|Object}`|`undefined`|Set PostCSS Parser|
|
||||
|[`syntax`](#syntaxes)|`{String\|Object}`|`undefined`|Set PostCSS Syntax|
|
||||
|[`stringifier`](#syntaxes)|`{String\|Object}`|`undefined`|Set PostCSS Stringifier|
|
||||
|[`config`](#config)|`{Object}`|`undefined`|Set `postcss.config.js` config path && `ctx`|
|
||||
|[`plugins`](#plugins)|`{Array\|Function}`|`[]`|Set PostCSS Plugins|
|
||||
|[`sourceMap`](#sourcemap)|`{String\|Boolean}`|`false`|Enable Source Maps|
|
||||
|
||||
### `Exec`
|
||||
|
||||
If you use JS styles without the [`postcss-js`][postcss-js] parser, add the `exec` option.
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.style.js$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
||||
{ loader: 'postcss-loader', options: { parser: 'sugarss', exec: true } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `Config`
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|[`path`](#path)|`{String}`|`undefined`|PostCSS Config Directory|
|
||||
|[`context`](#context)|`{Object}`|`undefined`|PostCSS Config Context|
|
||||
|
||||
#### `Path`
|
||||
|
||||
You can manually specify the path to search for your config (`postcss.config.js`) with the `config.path` option. This is needed if you store your config in a separate e.g `./config || ./.config` folder.
|
||||
|
||||
> ⚠️ Otherwise it is **unnecessary** to set this option and is **not** recommended
|
||||
|
||||
> ⚠️ Note that you **can't** use a **filename** other than the [supported config formats] (e.g `.postcssrc.js`, `postcss.config.js`), this option only allows you to manually specify the **directory** where config lookup should **start** from
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: {
|
||||
path: 'path/to/.config/' ✅
|
||||
path: 'path/to/.config/css.config.js' ❌
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[supported config formats]: https://github.com/michael-ciniawsky/postcss-load-config#usage
|
||||
|
||||
#### `Context (ctx)`
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|`env`|`{String}`|`'development'`|`process.env.NODE_ENV`|
|
||||
|`file`|`{Object}`|`loader.resourcePath`|`extname`, `dirname`, `basename`|
|
||||
|`options`|`{Object}`|`{}`|Options|
|
||||
|
||||
`postcss-loader` exposes context `ctx` to the config file, making your `postcss.config.js` dynamic, so can use it to do some real magic ✨
|
||||
|
||||
**`postcss.config.js`**
|
||||
```js
|
||||
module.exports = ({ file, options, env }) => ({
|
||||
parser: file.extname === '.sss' ? 'sugarss' : false,
|
||||
plugins: {
|
||||
'postcss-import': { root: file.dirname },
|
||||
'postcss-preset-env': options['postcss-preset-env'] ? options['postcss-preset-env'] : false,
|
||||
'cssnano': env === 'production' ? options.cssnano : false
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: {
|
||||
ctx: {
|
||||
'postcss-preset-env': {...options},
|
||||
cssnano: {...options},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `Plugins`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
ident: 'postcss',
|
||||
plugins: (loader) => [
|
||||
require('postcss-import')({ root: loader.resourcePath }),
|
||||
require('postcss-preset-env')(),
|
||||
require('cssnano')()
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> ⚠️ webpack requires an identifier (`ident`) in `options` when `{Function}/require` is used (Complex Options). The `ident` can be freely named as long as it is unique. It's recommended to name it (`ident: 'postcss'`)
|
||||
|
||||
### `Syntaxes`
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|[`parser`](#parser)|`{String\|Function}`|`undefined`|Custom PostCSS Parser|
|
||||
|[`syntax`](#syntax)|`{String\|Function}`|`undefined`|Custom PostCSS Syntax|
|
||||
|[`stringifier`](#stringifier)|`{String\|Function}`|`undefined`|Custom PostCSS Stringifier|
|
||||
|
||||
#### `Parser`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.sss$/,
|
||||
use: [
|
||||
...,
|
||||
{ loader: 'postcss-loader', options: { parser: 'sugarss' } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### `Syntax`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
...,
|
||||
{ loader: 'postcss-loader', options: { syntax: 'sugarss' } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### `Stringifier`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
...,
|
||||
{ loader: 'postcss-loader', options: { stringifier: 'midas' } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `SourceMap`
|
||||
|
||||
Enables source map support, `postcss-loader` will use the previous source map given by other loaders and update it accordingly, if no previous loader is applied before `postcss-loader`, the loader will generate a source map for you.
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css/,
|
||||
use: [
|
||||
{ loader: 'style-loader', options: { sourceMap: true } },
|
||||
{ loader: 'css-loader', options: { sourceMap: true } },
|
||||
{ loader: 'postcss-loader', options: { sourceMap: true } },
|
||||
{ loader: 'sass-loader', options: { sourceMap: true } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### `'inline'`
|
||||
|
||||
You can set the `sourceMap: 'inline'` option to inline the source map
|
||||
within the CSS directly as an annotation comment.
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: 'inline'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
.class { color: red; }
|
||||
|
||||
/*# sourceMappingURL=data:application/json;base64, ... */
|
||||
```
|
||||
|
||||
<h2 align="center">Examples</h2>
|
||||
|
||||
### `Stylelint`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
ident: 'postcss',
|
||||
plugins: [
|
||||
require('postcss-import')(),
|
||||
require('stylelint')(),
|
||||
...,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `Autoprefixing`
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
ident: 'postcss',
|
||||
plugins: [
|
||||
require('autoprefixer')({...options}),
|
||||
...,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
> :warning: [`postcss-preset-env`](https://github.com/csstools/postcss-preset-env) includes [`autoprefixer`](https://github.com/postcss/autoprefixer), so adding it separately is not necessary if you already use the preset.
|
||||
|
||||
### `CSS Modules`
|
||||
|
||||
This loader [cannot be used] with [CSS Modules] out of the box due
|
||||
to the way `css-loader` processes file imports. To make them work properly,
|
||||
either add the css-loader’s [`importLoaders`] option.
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{ loader: 'css-loader', options: { modules: true, importLoaders: 1 } },
|
||||
'postcss-loader'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
or use [postcss-modules] instead of `css-loader`.
|
||||
|
||||
[`importLoaders`]: https://github.com/webpack-contrib/css-loader#importloaders
|
||||
[cannot be used]: https://github.com/webpack/css-loader/issues/137
|
||||
[CSS Modules]: https://github.com/webpack/css-loader#css-modules
|
||||
[postcss-modules]: https://github.com/css-modules/postcss-modules
|
||||
|
||||
### `CSS-in-JS`
|
||||
|
||||
If you want to process styles written in JavaScript, use the [postcss-js] parser.
|
||||
|
||||
[postcss-js]: https://github.com/postcss/postcss-js
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
{
|
||||
test: /\.style.js$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{ loader: 'css-loader', options: { importLoaders: 2 } },
|
||||
{ loader: 'postcss-loader', options: { parser: 'postcss-js' } },
|
||||
'babel-loader'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
As result you will be able to write styles in the following way
|
||||
|
||||
```js
|
||||
import colors from './styles/colors'
|
||||
|
||||
export default {
|
||||
'.menu': {
|
||||
color: colors.main,
|
||||
height: 25,
|
||||
'&_link': {
|
||||
color: 'white'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> :warning: If you are using Babel you need to do the following in order for the setup to work
|
||||
|
||||
> 1. Add [babel-plugin-add-module-exports] to your configuration
|
||||
> 2. You need to have only one **default** export per style module
|
||||
|
||||
[babel-plugin-add-module-exports]: https://github.com/59naga/babel-plugin-add-module-exports
|
||||
|
||||
### [Extract CSS][ExtractPlugin]
|
||||
|
||||
[ExtractPlugin]: https://github.com/webpack-contrib/mini-css-extract-plugin
|
||||
|
||||
**`webpack.config.js`**
|
||||
```js
|
||||
const devMode = process.env.NODE_ENV !== 'production'
|
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({
|
||||
filename: devMode ? '[name].css' : '[name].[hash].css'
|
||||
})
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<h2 align="center">Maintainers</h2>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/michael-ciniawsky">
|
||||
<img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150">
|
||||
</br>
|
||||
Michael Ciniawsky
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/evilebottnawi">
|
||||
<img width="150" height="150" src="https://github.com/evilebottnawi.png?v=3&s=150">
|
||||
</br>
|
||||
Alexander Krasnoyarov
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/postcss-loader.svg
|
||||
[npm-url]: https://npmjs.com/package/postcss-loader
|
||||
|
||||
[node]: https://img.shields.io/node/v/postcss-loader.svg
|
||||
[node-url]: https://nodejs.org
|
||||
|
||||
[deps]: https://david-dm.org/postcss/postcss-loader.svg
|
||||
[deps-url]: https://david-dm.org/postcss/postcss-loader
|
||||
|
||||
[tests]: https://img.shields.io/travis/postcss/postcss-loader.svg
|
||||
[tests-url]: https://travis-ci.org/postcss/postcss-loader
|
||||
|
||||
[cover]: https://coveralls.io/repos/github/postcss/postcss-loader/badge.svg
|
||||
[cover-url]: https://coveralls.io/github/postcss/postcss-loader
|
||||
|
||||
[chat]: https://badges.gitter.im/postcss/postcss.svg
|
||||
[chat-url]: https://gitter.im/postcss/postcss
|
1
web/node_modules/postcss-loader/node_modules/.bin/json5
generated
vendored
Symbolic link
1
web/node_modules/postcss-loader/node_modules/.bin/json5
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../json5/lib/cli.js
|
274
web/node_modules/postcss-loader/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
274
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/LICENSE.md
generated
vendored
Normal file
23
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/README.md
generated
vendored
Normal file
234
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/dist/index.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/cli.js
generated
vendored
Executable file
2
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/index.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/parse.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/register.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/require.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/lib/util.js
generated
vendored
Normal file
1
web/node_modules/postcss-loader/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/postcss-loader/node_modules/json5/package.json
generated
vendored
Normal file
76
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
87
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/README.md
generated
vendored
Normal file
275
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
16
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
69
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
20
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
16
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
23
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
151
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
31
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
68
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
23
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
51
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
60
web/node_modules/postcss-loader/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/postcss-loader/node_modules/loader-utils/package.json
generated
vendored
Normal file
39
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
134
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/README.md
generated
vendored
Normal file
149
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/package.json
generated
vendored
Normal file
41
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/src/ValidationError.js
generated
vendored
Normal file
30
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/src/index.js
generated
vendored
Normal file
9
web/node_modules/postcss-loader/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/postcss-loader/node_modules/schema-utils/src/validateOptions.js
generated
vendored
Normal file
38
web/node_modules/postcss-loader/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;
|
48
web/node_modules/postcss-loader/package.json
generated
vendored
Normal file
48
web/node_modules/postcss-loader/package.json
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "postcss-loader",
|
||||
"version": "3.0.0",
|
||||
"description": "PostCSS loader for webpack",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"dependencies": {
|
||||
"loader-utils": "^1.1.0",
|
||||
"postcss": "^7.0.0",
|
||||
"postcss-load-config": "^2.0.0",
|
||||
"schema-utils": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webpack-utilities/test": "^1.0.0-alpha.0",
|
||||
"jest": "^23.0.0",
|
||||
"jsdoc-to-markdown": "^4.0.0",
|
||||
"postcss-import": "^11.0.0",
|
||||
"postcss-js": "^2.0.0",
|
||||
"standard": "^11.0.0",
|
||||
"standard-version": "^4.0.0",
|
||||
"sugarss": "^1.0.0",
|
||||
"webpack": "^4.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard --env jest",
|
||||
"test": "jest --env node --verbose --coverage",
|
||||
"docs": "jsdoc2md src/*.js > docs/LOADER.md",
|
||||
"clean": "rm -rf coverage test/outputs",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"postcss",
|
||||
"postcss-runner",
|
||||
"webpack",
|
||||
"webpack-loader"
|
||||
],
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"repository": "https://github.com/postcss/postcss-loader.git",
|
||||
"bugs": "https://github.com/postcss/postcss-loader/issues",
|
||||
"homepage": "https://github.com/postcss/postcss-loader#readme",
|
||||
"license": "MIT"
|
||||
}
|
37
web/node_modules/postcss-loader/src/Error.js
generated
vendored
Normal file
37
web/node_modules/postcss-loader/src/Error.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* **PostCSS Syntax Error**
|
||||
*
|
||||
* Loader wrapper for postcss syntax errors
|
||||
*
|
||||
* @class SyntaxError
|
||||
* @extends Error
|
||||
*
|
||||
* @param {Object} err CssSyntaxError
|
||||
*/
|
||||
class SyntaxError extends Error {
|
||||
constructor (error) {
|
||||
super(error)
|
||||
|
||||
const { line, column, reason } = error
|
||||
|
||||
this.name = 'SyntaxError'
|
||||
|
||||
this.message = `${this.name}\n\n`
|
||||
|
||||
if (typeof line !== 'undefined') {
|
||||
this.message += `(${line}:${column}) `
|
||||
}
|
||||
|
||||
this.message += `${reason}`
|
||||
|
||||
const code = error.showSourceCode()
|
||||
|
||||
if (code) {
|
||||
this.message += `\n\n${code}\n`
|
||||
}
|
||||
|
||||
this.stack = false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SyntaxError
|
31
web/node_modules/postcss-loader/src/Warning.js
generated
vendored
Normal file
31
web/node_modules/postcss-loader/src/Warning.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* **PostCSS Plugin Warning**
|
||||
*
|
||||
* Loader wrapper for postcss plugin warnings (`root.messages`)
|
||||
*
|
||||
* @class Warning
|
||||
* @extends Error
|
||||
*
|
||||
* @param {Object} warning PostCSS Warning
|
||||
*/
|
||||
class Warning extends Error {
|
||||
constructor (warning) {
|
||||
super(warning)
|
||||
|
||||
const { text, line, column } = warning
|
||||
|
||||
this.name = 'Warning'
|
||||
|
||||
this.message = `${this.name}\n\n`
|
||||
|
||||
if (typeof line !== 'undefined') {
|
||||
this.message += `(${line}:${column}) `
|
||||
}
|
||||
|
||||
this.message += `${text}`
|
||||
|
||||
this.stack = false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Warning
|
232
web/node_modules/postcss-loader/src/index.js
generated
vendored
Normal file
232
web/node_modules/postcss-loader/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,232 @@
|
|||
const path = require('path')
|
||||
|
||||
const { getOptions } = require('loader-utils')
|
||||
const validateOptions = require('schema-utils')
|
||||
|
||||
const postcss = require('postcss')
|
||||
const postcssrc = require('postcss-load-config')
|
||||
|
||||
const Warning = require('./Warning.js')
|
||||
const SyntaxError = require('./Error.js')
|
||||
const parseOptions = require('./options.js')
|
||||
|
||||
/**
|
||||
* **PostCSS Loader**
|
||||
*
|
||||
* Loads && processes CSS with [PostCSS](https://github.com/postcss/postcss)
|
||||
*
|
||||
* @method loader
|
||||
*
|
||||
* @param {String} css Source
|
||||
* @param {Object} map Source Map
|
||||
*
|
||||
* @return {cb} cb Result
|
||||
*/
|
||||
function loader (css, map, meta) {
|
||||
const options = Object.assign({}, getOptions(this))
|
||||
|
||||
validateOptions(require('./options.json'), options, 'PostCSS Loader')
|
||||
|
||||
const cb = this.async()
|
||||
const file = this.resourcePath
|
||||
|
||||
const sourceMap = options.sourceMap
|
||||
|
||||
Promise.resolve().then(() => {
|
||||
const length = Object.keys(options)
|
||||
.filter((option) => {
|
||||
switch (option) {
|
||||
// case 'exec':
|
||||
case 'ident':
|
||||
case 'config':
|
||||
case 'sourceMap':
|
||||
return
|
||||
default:
|
||||
return option
|
||||
}
|
||||
})
|
||||
.length
|
||||
|
||||
if (length) {
|
||||
return parseOptions.call(this, options)
|
||||
}
|
||||
|
||||
const rc = {
|
||||
path: path.dirname(file),
|
||||
ctx: {
|
||||
file: {
|
||||
extname: path.extname(file),
|
||||
dirname: path.dirname(file),
|
||||
basename: path.basename(file)
|
||||
},
|
||||
options: {}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.config) {
|
||||
if (options.config.path) {
|
||||
rc.path = path.resolve(options.config.path)
|
||||
}
|
||||
|
||||
if (options.config.ctx) {
|
||||
rc.ctx.options = options.config.ctx
|
||||
}
|
||||
}
|
||||
|
||||
rc.ctx.webpack = this
|
||||
|
||||
return postcssrc(rc.ctx, rc.path)
|
||||
}).then((config) => {
|
||||
if (!config) {
|
||||
config = {}
|
||||
}
|
||||
|
||||
if (config.file) {
|
||||
this.addDependency(config.file)
|
||||
}
|
||||
|
||||
// Disable override `to` option from `postcss.config.js`
|
||||
if (config.options.to) {
|
||||
delete config.options.to
|
||||
}
|
||||
// Disable override `from` option from `postcss.config.js`
|
||||
if (config.options.from) {
|
||||
delete config.options.from
|
||||
}
|
||||
|
||||
let plugins = config.plugins || []
|
||||
|
||||
let options = Object.assign({
|
||||
from: file,
|
||||
map: sourceMap
|
||||
? sourceMap === 'inline'
|
||||
? { inline: true, annotation: false }
|
||||
: { inline: false, annotation: false }
|
||||
: false
|
||||
}, config.options)
|
||||
|
||||
// Loader Exec (Deprecated)
|
||||
// https://webpack.js.org/api/loaders/#deprecated-context-properties
|
||||
if (options.parser === 'postcss-js') {
|
||||
css = this.exec(css, this.resource)
|
||||
}
|
||||
|
||||
if (typeof options.parser === 'string') {
|
||||
options.parser = require(options.parser)
|
||||
}
|
||||
|
||||
if (typeof options.syntax === 'string') {
|
||||
options.syntax = require(options.syntax)
|
||||
}
|
||||
|
||||
if (typeof options.stringifier === 'string') {
|
||||
options.stringifier = require(options.stringifier)
|
||||
}
|
||||
|
||||
// Loader API Exec (Deprecated)
|
||||
// https://webpack.js.org/api/loaders/#deprecated-context-properties
|
||||
if (config.exec) {
|
||||
css = this.exec(css, this.resource)
|
||||
}
|
||||
|
||||
if (sourceMap && typeof map === 'string') {
|
||||
map = JSON.parse(map)
|
||||
}
|
||||
|
||||
if (sourceMap && map) {
|
||||
options.map.prev = map
|
||||
}
|
||||
|
||||
return postcss(plugins)
|
||||
.process(css, options)
|
||||
.then((result) => {
|
||||
let { css, map, root, processor, messages } = result
|
||||
|
||||
result.warnings().forEach((warning) => {
|
||||
this.emitWarning(new Warning(warning))
|
||||
})
|
||||
|
||||
messages.forEach((msg) => {
|
||||
if (msg.type === 'dependency') {
|
||||
this.addDependency(msg.file)
|
||||
}
|
||||
})
|
||||
|
||||
map = map ? map.toJSON() : null
|
||||
|
||||
if (map) {
|
||||
map.file = path.resolve(map.file)
|
||||
map.sources = map.sources.map((src) => path.resolve(src))
|
||||
}
|
||||
|
||||
if (!meta) {
|
||||
meta = {}
|
||||
}
|
||||
|
||||
const ast = {
|
||||
type: 'postcss',
|
||||
version: processor.version,
|
||||
root
|
||||
}
|
||||
|
||||
meta.ast = ast
|
||||
meta.messages = messages
|
||||
|
||||
if (this.loaderIndex === 0) {
|
||||
/**
|
||||
* @memberof loader
|
||||
* @callback cb
|
||||
*
|
||||
* @param {Object} null Error
|
||||
* @param {String} css Result (JS Module)
|
||||
* @param {Object} map Source Map
|
||||
*/
|
||||
cb(null, `module.exports = ${JSON.stringify(css)}`, map)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof loader
|
||||
* @callback cb
|
||||
*
|
||||
* @param {Object} null Error
|
||||
* @param {String} css Result (Raw Module)
|
||||
* @param {Object} map Source Map
|
||||
*/
|
||||
cb(null, css, map, meta)
|
||||
|
||||
return null
|
||||
})
|
||||
}).catch((err) => {
|
||||
if (err.file) {
|
||||
this.addDependency(err.file)
|
||||
}
|
||||
|
||||
return err.name === 'CssSyntaxError'
|
||||
? cb(new SyntaxError(err))
|
||||
: cb(err)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Andrey Sitnik (@ai) <andrey@sitnik.ru>
|
||||
*
|
||||
* @license MIT
|
||||
* @version 3.0.0
|
||||
*
|
||||
* @module postcss-loader
|
||||
*
|
||||
* @requires path
|
||||
*
|
||||
* @requires loader-utils
|
||||
* @requires schema-utils
|
||||
*
|
||||
* @requires postcss
|
||||
* @requires postcss-load-config
|
||||
*
|
||||
* @requires ./options.js
|
||||
* @requires ./Warning.js
|
||||
* @requires ./SyntaxError.js
|
||||
*/
|
||||
module.exports = loader
|
36
web/node_modules/postcss-loader/src/options.js
generated
vendored
Normal file
36
web/node_modules/postcss-loader/src/options.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* **PostCSS Options Parser**
|
||||
*
|
||||
* Transforms the loader options into a valid postcss config `{Object}`
|
||||
*
|
||||
* @method parseOptions
|
||||
*
|
||||
* @param {Boolean} exec Execute CSS-in-JS
|
||||
* @param {String|Object} parser PostCSS Parser
|
||||
* @param {String|Object} syntax PostCSS Syntax
|
||||
* @param {String|Object} stringifier PostCSS Stringifier
|
||||
* @param {Array|Object|Function} plugins PostCSS Plugins
|
||||
*
|
||||
* @return {Promise} PostCSS Config
|
||||
*/
|
||||
function parseOptions ({ exec, parser, syntax, stringifier, plugins }) {
|
||||
if (typeof plugins === 'function') {
|
||||
plugins = plugins.call(this, this)
|
||||
}
|
||||
|
||||
if (typeof plugins === 'undefined') {
|
||||
plugins = []
|
||||
} else if (!Array.isArray(plugins)) {
|
||||
plugins = [ plugins ]
|
||||
}
|
||||
|
||||
const options = {}
|
||||
|
||||
options.parser = parser
|
||||
options.syntax = syntax
|
||||
options.stringifier = stringifier
|
||||
|
||||
return Promise.resolve({ options, plugins, exec })
|
||||
}
|
||||
|
||||
module.exports = parseOptions
|
57
web/node_modules/postcss-loader/src/options.json
generated
vendored
Normal file
57
web/node_modules/postcss-loader/src/options.json
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"ctx": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"properties": {
|
||||
"ctx": "should be {Object} (https://github.com/postcss/postcss-loader#context-ctx)",
|
||||
"path": "should be {String} (https://github.com/postcss/postcss-loader#path)"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"exec": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parser": {
|
||||
"type": [ "string", "object" ]
|
||||
},
|
||||
"syntax": {
|
||||
"type": [ "string", "object" ]
|
||||
},
|
||||
"stringifier": {
|
||||
"type": [ "string", "object" ]
|
||||
},
|
||||
"plugins": {
|
||||
"anyOf": [
|
||||
{ "type": "array" },
|
||||
{ "type": "object" },
|
||||
{ "instanceof": "Function" }
|
||||
]
|
||||
},
|
||||
"sourceMap": {
|
||||
"type": [ "string", "boolean" ]
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"properties": {
|
||||
"exec": "should be {Boolean} (https://github.com/postcss/postcss-loader#exec)",
|
||||
"config": "should be {Object} (https://github.com/postcss/postcss-loader#config)",
|
||||
"parser": "should be {String|Object} (https://github.com/postcss/postcss-loader#parser)",
|
||||
"syntax": "should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)",
|
||||
"stringifier": "should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)",
|
||||
"plugins": "should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)",
|
||||
"sourceMap": "should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue