-| Name | Type | Default | Description |
-| :------------------------: | :----------------------------------------------------------: | :----------------: | :------------------------------------------- |
-| [`exec`](#exec) | `{Boolean}` | `undefined` | Enable PostCSS Parser support in `CSS-in-JS` |
-| [`parser`](#syntaxes) | `{String\|Object\|Function}` | `undefined` | Set PostCSS Parser |
-| [`syntax`](#syntaxes) | `{String\|Object}` | `undefined` | Set PostCSS Syntax |
-| [`stringifier`](#syntaxes) | `{String\|Object\|Function}` | `undefined` | Set PostCSS Stringifier |
-| [`config`](#config) | `{String\|Object\|Boolean}` | `undefined` | Set `postcss.config.js` config path && `ctx` |
-| [`plugins`](#plugins) | `{Function\|Object\|Array}` | `[]` | Set PostCSS Plugins |
-| [`sourceMap`](#sourcemap) | `{String\|Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps |
+| Name | Type | Default | Description |
+| :---------------------------------: | :-------------------------: | :-----------------------------------: | :---------------------------------------------- |
+| [`exec`](#exec) | `{Boolean}` | `undefined` | Enable PostCSS Parser support in `CSS-in-JS` |
+| [`config`](#config) | `{String\|Object\|Boolean}` | `undefined` | Set `postcss.config.js` config path && `ctx` |
+| [`postcssOptions`](#postcssOptions) | `{Object}` | `defaults values for Postcss.process` | Set Postcss.process options and postcss plugins |
+| [`sourceMap`](#sourcemap) | `{String\|Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps |
### `Exec`
@@ -139,7 +140,12 @@ module.exports = {
{ loader: 'css-loader', options: { importLoaders: 1 } },
{
loader: 'postcss-loader',
- options: { parser: 'sugarss', exec: true },
+ options: {
+ postcssOptions: {
+ parser: 'sugarss',
+ },
+ exec: true,
+ },
},
],
},
@@ -290,7 +296,16 @@ module.exports = {
};
```
-### `Plugins`
+### `postcssOptions`
+
+| Name | Type | Default | Description |
+| :---------------------------: | :-------------------------------------------: | :---------: | :----------------------------- |
+| [`plugins`](#plugins) | `{Function\|Object\|Array}` | `[]` | Set PostCSS Plugins |
+| [`parser`](#parser) | `{String\|Object\|Function}` | `undefined` | Set custom PostCSS Parser |
+| [`syntax`](#syntax) | `{String\|Object}` | `undefined` | Set custom PostCSS Syntax |
+| [`stringifier`](#stringifier) | `{String\|Object\|Function}` | `undefined` | Set custom PostCSS Stringifier |
+
+#### `Plugins`
Type: `Function|Object|Array`
Default: `[]`
@@ -352,11 +367,13 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- plugins: (loader) => [
- require('postcss-import')({ root: loader.resourcePath }),
- require('postcss-preset-env')(),
- require('cssnano')(),
- ],
+ postcssOptions: {
+ plugins: (loader) => [
+ require('postcss-import')({ root: loader.resourcePath }),
+ require('postcss-preset-env')(),
+ require('cssnano')(),
+ ],
+ },
},
},
],
@@ -394,11 +411,11 @@ It is possible to disable the plugin specified in the config.
```js
module.exports = {
- plugins: [
- ['postcss-short', { prefix: 'x' }],
- 'postcss-import',
- 'postcss-nested',
- ],
+ plugins: {
+ 'postcss-short': { prefix: 'x' },
+ 'postcss-import': {},
+ 'postcss-nested': {},
+ },
};
```
@@ -412,11 +429,13 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- plugins: {
- 'postcss-import': {},
- 'postcss-nested': {},
- // Turn off the plugin
- 'postcss-short': false,
+ postcssOptions: {
+ plugins: {
+ 'postcss-import': {},
+ 'postcss-nested': {},
+ // Turn off the plugin
+ 'postcss-short': false,
+ },
},
},
},
@@ -425,17 +444,6 @@ module.exports = {
};
```
-### `Syntaxes`
-
-Type: `String|Object`
-Default: `undefined`
-
-| Name | Type | Default | Description |
-| :---------------------------: | :--------------------------: | :---------: | :------------------------- |
-| [`parser`](#parser) | `{String\|Object}` | `undefined` | Custom PostCSS Parser |
-| [`syntax`](#syntax) | `{String\|Object}` | `undefined` | Custom PostCSS Syntax |
-| [`stringifier`](#stringifier) | `{String\|Object\|Function}` | `undefined` | Custom PostCSS Stringifier |
-
#### `Parser`
Type: `String|Object|Function`
@@ -455,8 +463,10 @@ module.exports = {
test: /\.sss$/i,
loader: 'postcss-loader',
options: {
- // Will be converted to `require('sugarss')`
- parser: 'sugarss',
+ postcssOptions: {
+ // Will be converted to `require('sugarss')`
+ parser: 'sugarss',
+ },
},
},
],
@@ -476,7 +486,9 @@ module.exports = {
test: /\.sss$/i,
loader: 'postcss-loader',
options: {
- parser: require('sugarss'),
+ postcssOptions: {
+ parser: require('sugarss'),
+ },
},
},
],
@@ -496,7 +508,9 @@ module.exports = {
test: /\.sss$/i,
loader: 'postcss-loader',
options: {
- parser: require('sugarss').parse,
+ postcssOptions: {
+ parser: require('sugarss').parse,
+ },
},
},
],
@@ -523,8 +537,10 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- // Will be converted to `require('sugarss')`
- syntax: 'sugarss',
+ postcssOptions: {
+ // Will be converted to `require('sugarss')`
+ syntax: 'sugarss',
+ },
},
},
],
@@ -544,7 +560,9 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- stringifier: require('sugarss'),
+ postcssOptions: {
+ stringifier: require('sugarss'),
+ },
},
},
],
@@ -571,8 +589,10 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- // Will be converted to `require('sugarss')`
- stringifier: 'sugarss',
+ postcssOptions: {
+ // Will be converted to `require('sugarss')`
+ stringifier: 'sugarss',
+ },
},
},
],
@@ -592,7 +612,9 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- stringifier: require('sugarss'),
+ postcssOptions: {
+ stringifier: require('sugarss'),
+ },
},
},
],
@@ -615,7 +637,9 @@ module.exports = {
test: /\.css$/i,
loader: 'postcss-loader',
options: {
- stringifier: midas.stringifier,
+ postcssOptions: {
+ stringifier: midas.stringifier,
+ },
},
},
],
@@ -707,7 +731,9 @@ module.exports = {
{
loader: 'postcss-loader',
options: {
- plugins: ['postcss-import', 'stylelint'],
+ postcssOptions: {
+ plugins: ['postcss-import', 'stylelint'],
+ },
},
},
],
@@ -733,7 +759,9 @@ module.exports = {
{
loader: 'postcss-loader',
options: {
- plugins: [['autoprefixer', { ...options }]],
+ postcssOptions: {
+ plugins: [['autoprefixer', { ...options }]],
+ },
},
},
],
@@ -797,7 +825,14 @@ module.exports = {
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 2 } },
- { loader: 'postcss-loader', options: { parser: 'postcss-js' } },
+ {
+ loader: 'postcss-loader',
+ options: {
+ postcssOptions: {
+ parser: 'postcss-js',
+ },
+ },
+ },
'babel-loader',
],
},
@@ -896,7 +931,9 @@ module.exports = {
{
loader: 'postcss-loader',
options: {
- plugins: [postcssPlugin()],
+ postcssOptions: {
+ plugins: [postcssPlugin()],
+ },
},
},
],
@@ -942,7 +979,9 @@ module.exports = {
{
loader: 'postcss-loader',
options: {
- plugins: [postcssPlugin()],
+ postcssOptions: {
+ plugins: [postcssPlugin()],
+ },
},
},
],
@@ -982,7 +1021,9 @@ module.exports = {
```js
module.exports = (loaderContext) => ({
- plugins: [require('path/to/customPlugin')(loaderContext)],
+ postcssOptions: {
+ plugins: [require('path/to/customPlugin')(loaderContext)],
+ },
});
```
diff --git a/src/index.js b/src/index.js
index 2e23506c..2deeb7fa 100644
--- a/src/index.js
+++ b/src/index.js
@@ -40,10 +40,14 @@ export default async function loader(content, sourceMap, meta = {}) {
const callback = this.async();
const file = this.resourcePath;
- let loadedConfig = {};
const configOptions =
- typeof options.config === 'undefined' ? true : options.config;
+ typeof options.postcssOptions === 'undefined' ||
+ typeof options.postcssOptions.config === 'undefined'
+ ? true
+ : options.postcssOptions.config;
+
+ let loadedConfig = {};
if (configOptions) {
const dataForLoadConfig = {
@@ -82,6 +86,8 @@ export default async function loader(content, sourceMap, meta = {}) {
}
}
+ options.postcssOptions = options.postcssOptions || {};
+
let plugins;
const disabledPlugins = [];
@@ -89,7 +95,12 @@ export default async function loader(content, sourceMap, meta = {}) {
try {
plugins = [
...getArrayPlugins(loadedConfig.plugins, file, false, this),
- ...getArrayPlugins(options.plugins, file, disabledPlugins, this),
+ ...getArrayPlugins(
+ options.postcssOptions.plugins,
+ file,
+ disabledPlugins,
+ this
+ ),
].filter((i) => !disabledPlugins.includes(i.postcssPlugin));
} catch (error) {
this.emitError(error);
@@ -101,9 +112,9 @@ export default async function loader(content, sourceMap, meta = {}) {
plugins,
};
- const resultPlugins = mergedOptions.plugins;
+ mergedOptions.postcssOptions.plugins = plugins;
- const { parser, syntax, stringifier } = mergedOptions;
+ const resultPlugins = mergedOptions.postcssOptions.plugins;
const useSourceMap =
typeof options.sourceMap !== 'undefined'
@@ -127,17 +138,13 @@ export default async function loader(content, sourceMap, meta = {}) {
? { inline: true, annotation: false }
: { inline: false, annotation: false }
: false,
- parser,
- syntax,
- stringifier,
+ ...mergedOptions.postcssOptions,
};
if (postcssOptions.map && sourceMapNormalized) {
postcssOptions.map.prev = sourceMapNormalized;
}
- // Loader Exec (Deprecated)
- // https://webpack.js.org/api/loaders/#deprecated-context-properties
if (postcssOptions.parser === 'postcss-js') {
// eslint-disable-next-line no-param-reassign
content = exec(content, this);
@@ -145,7 +152,7 @@ export default async function loader(content, sourceMap, meta = {}) {
if (typeof postcssOptions.parser === 'string') {
try {
- // eslint-disable-next-line import/no-dynamic-require,global-require
+ // eslint-disable-next-line import/no-dynamic-require, global-require
postcssOptions.parser = require(postcssOptions.parser);
} catch (error) {
this.emitError(
@@ -156,7 +163,7 @@ export default async function loader(content, sourceMap, meta = {}) {
if (typeof postcssOptions.syntax === 'string') {
try {
- // eslint-disable-next-line import/no-dynamic-require,global-require
+ // eslint-disable-next-line import/no-dynamic-require, global-require
postcssOptions.syntax = require(postcssOptions.syntax);
} catch (error) {
this.emitError(
@@ -167,7 +174,7 @@ export default async function loader(content, sourceMap, meta = {}) {
if (typeof postcssOptions.stringifier === 'string') {
try {
- // eslint-disable-next-line import/no-dynamic-require,global-require
+ // eslint-disable-next-line import/no-dynamic-require, global-require
postcssOptions.stringifier = require(postcssOptions.stringifier);
} catch (error) {
this.emitError(
@@ -176,8 +183,6 @@ export default async function loader(content, sourceMap, meta = {}) {
}
}
- // Loader API Exec (Deprecated)
- // https://webpack.js.org/api/loaders/#deprecated-context-properties
if (mergedOptions.exec) {
// eslint-disable-next-line no-param-reassign
content = exec(content, this);
@@ -225,7 +230,7 @@ export default async function loader(content, sourceMap, meta = {}) {
map = map ? map.toJSON() : null;
- if (map) {
+ if (map && useSourceMap) {
if (typeof map.file !== 'undefined') {
delete map.file;
}
diff --git a/src/options.json b/src/options.json
index 4d26bc3c..c288bd58 100644
--- a/src/options.json
+++ b/src/options.json
@@ -1,86 +1,100 @@
{
"type": "object",
"properties": {
- "config": {
- "description": "should be {Object} (https://github.com/postcss/postcss-loader#config)",
+ "postcssOptions": {
+ "description": "Options to pass through to `Postcss`.",
"anyOf": [
{
"type": "object",
+ "additionalProperties": true,
"properties": {
- "path": {
- "description": "should be {String} (https://github.com/postcss/postcss-loader#path)",
- "type": "string"
+ "config": {
+ "description": "Allows to specify PostCSS Config Path (https://github.com/postcss/postcss-loader#config)",
+ "anyOf": [
+ {
+ "type": "object",
+ "properties": {
+ "path": {
+ "description": "Allows to specify PostCSS Config Path (https://github.com/postcss/postcss-loader#path)",
+ "type": "string"
+ },
+ "ctx": {
+ "description": "Allows to specify PostCSS Config Context (https://github.com/postcss/postcss-loader#context-ctx)",
+ "type": "object"
+ }
+ },
+ "additionalProperties": false
+ },
+ {
+ "description": "Allows to specify the path to the configuration file",
+ "type": "string"
+ },
+ {
+ "description": "Enables/Disables autoloading config",
+ "type": "boolean"
+ }
+ ]
},
- "ctx": {
- "description": "should be {Object} (https://github.com/postcss/postcss-loader#context-ctx)",
- "type": "object"
+ "parser": {
+ "description": "Allows to specify custom Postcss Parser (https://github.com/postcss/postcss-loader#parser)",
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "object"
+ },
+ {
+ "instanceof": "Function"
+ }
+ ]
+ },
+ "syntax": {
+ "description": "Allows to specify custom Postcss Syntax (https://github.com/postcss/postcss-loader#syntax)",
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
+ "stringifier": {
+ "description": "Allows to specify custom Postcss stringifier (https://github.com/postcss/postcss-loader#stringifier)",
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "object"
+ },
+ {
+ "instanceof": "Function"
+ }
+ ]
+ },
+ "plugins": {
+ "description": "Set PostCSS Plugins (https://github.com/postcss/postcss-loader#plugins)",
+ "anyOf": [
+ { "type": "array" },
+ { "type": "object" },
+ { "instanceof": "Function" }
+ ]
}
- },
- "additionalProperties": false
- },
- {
- "description": "Allows to specify the path to the configuration file",
- "type": "string"
+ }
},
{
- "description": "Enables/Disables autoloading config",
- "type": "boolean"
+ "instanceof": "Function"
}
]
},
"exec": {
- "description": "should be {Boolean} (https://github.com/postcss/postcss-loader#exec)",
+ "description": "Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)",
"type": "boolean"
},
- "parser": {
- "description": "should be {String|Object} (https://github.com/postcss/postcss-loader#parser)",
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "object"
- },
- {
- "instanceof": "Function"
- }
- ]
- },
- "syntax": {
- "description": "should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)",
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "object"
- }
- ]
- },
- "stringifier": {
- "description": "should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)",
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "object"
- },
- {
- "instanceof": "Function"
- }
- ]
- },
- "plugins": {
- "description": "should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)",
- "anyOf": [
- { "type": "array" },
- { "type": "object" },
- { "instanceof": "Function" }
- ]
- },
"sourceMap": {
- "description": "should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)",
+ "description": "Enables/Disables generation of source maps (https://github.com/postcss/postcss-loader#sourcemap)",
"anyOf": [
{
"type": "string"
diff --git a/src/utils.js b/src/utils.js
index b120dc04..8853eeb5 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -151,6 +151,7 @@ async function loadConfig(config, context, configPath, loaderContext) {
if (result.filepath) {
resultConfig.file = result.filepath;
+
loaderContext.addDependency(result.filepath);
}
diff --git a/test/__snapshots__/validate-options.test.js.snap b/test/__snapshots__/validate-options.test.js.snap
index db1493c2..84339dbb 100644
--- a/test/__snapshots__/validate-options.test.js.snap
+++ b/test/__snapshots__/validate-options.test.js.snap
@@ -1,276 +1,287 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`validate options should throw an error on the "config" option with "[]" value 1`] = `
-"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.config should be one of these:
- object { path?, ctx? } | string | boolean
- -> should be {Object} (https://github.com/postcss/postcss-loader#config)
- Details:
- * options.config should be an object:
- object { path?, ctx? }
- * options.config should be a string.
- -> Allows to specify the path to the configuration file
- * options.config should be a boolean.
- -> Enables/Disables autoloading config"
-`;
-
-exports[`validate options should throw an error on the "config" option with "{"foo":"bar"}" value 1`] = `
-"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.config has an unknown property 'foo'. These properties are valid:
- object { path?, ctx? }"
-`;
-
exports[`validate options should throw an error on the "exec" option with "/test/" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
exports[`validate options should throw an error on the "exec" option with "[]" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
exports[`validate options should throw an error on the "exec" option with "{"foo":"bar"}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
exports[`validate options should throw an error on the "exec" option with "{}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
exports[`validate options should throw an error on the "exec" option with "1" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
exports[`validate options should throw an error on the "exec" option with "test" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options.exec should be a boolean.
- -> should be {Boolean} (https://github.com/postcss/postcss-loader#exec)"
+ -> Enable PostCSS Parser support in 'CSS-in-JS' (https://github.com/postcss/postcss-loader#exec)"
`;
-exports[`validate options should throw an error on the "parser" option with "[]" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"config":[]}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.parser should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#parser)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.parser should be a string.
- * options.parser should be an object:
- object { … }
- * options.parser should be an instance of function."
+ * options.postcssOptions.config should be one of these:
+ object { path?, ctx? } | string | boolean
+ -> Allows to specify PostCSS Config Path (https://github.com/postcss/postcss-loader#config)
+ Details:
+ * options.postcssOptions.config should be an object:
+ object { path?, ctx? }
+ * options.postcssOptions.config should be a string.
+ -> Allows to specify the path to the configuration file
+ * options.postcssOptions.config should be a boolean.
+ -> Enables/Disables autoloading config"
`;
-exports[`validate options should throw an error on the "parser" option with "1" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"parser":[]}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.parser should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#parser)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.parser should be a string.
- * options.parser should be an object:
- object { … }
- * options.parser should be an instance of function."
+ * options.postcssOptions.parser should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss Parser (https://github.com/postcss/postcss-loader#parser)
+ Details:
+ * options.postcssOptions.parser should be a string.
+ * options.postcssOptions.parser should be an object:
+ object { … }
+ * options.postcssOptions.parser should be an instance of function."
`;
-exports[`validate options should throw an error on the "parser" option with "false" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"parser":1}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.parser should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#parser)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.parser should be a string.
- * options.parser should be an object:
- object { … }
- * options.parser should be an instance of function."
+ * options.postcssOptions.parser should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss Parser (https://github.com/postcss/postcss-loader#parser)
+ Details:
+ * options.postcssOptions.parser should be a string.
+ * options.postcssOptions.parser should be an object:
+ object { … }
+ * options.postcssOptions.parser should be an instance of function."
`;
-exports[`validate options should throw an error on the "parser" option with "true" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"parser":true}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.parser should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#parser)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.parser should be a string.
- * options.parser should be an object:
- object { … }
- * options.parser should be an instance of function."
+ * options.postcssOptions.parser should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss Parser (https://github.com/postcss/postcss-loader#parser)
+ Details:
+ * options.postcssOptions.parser should be a string.
+ * options.postcssOptions.parser should be an object:
+ object { … }
+ * options.postcssOptions.parser should be an instance of function."
`;
-exports[`validate options should throw an error on the "plugins" option with "1" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"plugins":"postcss-short"}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.plugins should be one of these:
- [any, ...] | object { … } | function
- -> should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.plugins should be an array:
- [any, ...]
- * options.plugins should be an object:
- object { … }
- * options.plugins should be an instance of function."
+ * options.postcssOptions.plugins should be one of these:
+ [any, ...] | object { … } | function
+ -> Set PostCSS Plugins (https://github.com/postcss/postcss-loader#plugins)
+ Details:
+ * options.postcssOptions.plugins should be an array:
+ [any, ...]
+ * options.postcssOptions.plugins should be an object:
+ object { … }
+ * options.postcssOptions.plugins should be an instance of function."
`;
-exports[`validate options should throw an error on the "plugins" option with "false" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"plugins":1}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.plugins should be one of these:
- [any, ...] | object { … } | function
- -> should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.plugins should be an array:
- [any, ...]
- * options.plugins should be an object:
- object { … }
- * options.plugins should be an instance of function."
+ * options.postcssOptions.plugins should be one of these:
+ [any, ...] | object { … } | function
+ -> Set PostCSS Plugins (https://github.com/postcss/postcss-loader#plugins)
+ Details:
+ * options.postcssOptions.plugins should be an array:
+ [any, ...]
+ * options.postcssOptions.plugins should be an object:
+ object { … }
+ * options.postcssOptions.plugins should be an instance of function."
`;
-exports[`validate options should throw an error on the "plugins" option with "true" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"plugins":true}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.plugins should be one of these:
- [any, ...] | object { … } | function
- -> should be {Array|Object|Function} (https://github.com/postcss/postcss-loader#plugins)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.plugins should be an array:
- [any, ...]
- * options.plugins should be an object:
- object { … }
- * options.plugins should be an instance of function."
+ * options.postcssOptions.plugins should be one of these:
+ [any, ...] | object { … } | function
+ -> Set PostCSS Plugins (https://github.com/postcss/postcss-loader#plugins)
+ Details:
+ * options.postcssOptions.plugins should be an array:
+ [any, ...]
+ * options.postcssOptions.plugins should be an object:
+ object { … }
+ * options.postcssOptions.plugins should be an instance of function."
`;
-exports[`validate options should throw an error on the "sourceMap" option with "/test/" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"stringifier":[]}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.sourceMap should be one of these:
- string | boolean
- -> should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.sourceMap should be a string.
- * options.sourceMap should be a boolean."
+ * options.postcssOptions.stringifier should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss stringifier (https://github.com/postcss/postcss-loader#stringifier)
+ Details:
+ * options.postcssOptions.stringifier should be a string.
+ * options.postcssOptions.stringifier should be an object:
+ object { … }
+ * options.postcssOptions.stringifier should be an instance of function."
`;
-exports[`validate options should throw an error on the "sourceMap" option with "[]" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"stringifier":1}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.sourceMap should be one of these:
- string | boolean
- -> should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.sourceMap should be a string.
- * options.sourceMap should be a boolean."
+ * options.postcssOptions.stringifier should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss stringifier (https://github.com/postcss/postcss-loader#stringifier)
+ Details:
+ * options.postcssOptions.stringifier should be a string.
+ * options.postcssOptions.stringifier should be an object:
+ object { … }
+ * options.postcssOptions.stringifier should be an instance of function."
`;
-exports[`validate options should throw an error on the "sourceMap" option with "{}" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"stringifier":true}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.sourceMap should be one of these:
- string | boolean
- -> should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.sourceMap should be a string.
- * options.sourceMap should be a boolean."
+ * options.postcssOptions.stringifier should be one of these:
+ string | object { … } | function
+ -> Allows to specify custom Postcss stringifier (https://github.com/postcss/postcss-loader#stringifier)
+ Details:
+ * options.postcssOptions.stringifier should be a string.
+ * options.postcssOptions.stringifier should be an object:
+ object { … }
+ * options.postcssOptions.stringifier should be an instance of function."
`;
-exports[`validate options should throw an error on the "sourceMap" option with "1" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"syntax":[]}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.sourceMap should be one of these:
- string | boolean
- -> should be {String|Boolean} (https://github.com/postcss/postcss-loader#sourcemap)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.sourceMap should be a string.
- * options.sourceMap should be a boolean."
+ * options.postcssOptions.syntax should be one of these:
+ string | object { … }
+ -> Allows to specify custom Postcss Syntax (https://github.com/postcss/postcss-loader#syntax)
+ Details:
+ * options.postcssOptions.syntax should be a string.
+ * options.postcssOptions.syntax should be an object:
+ object { … }"
`;
-exports[`validate options should throw an error on the "stringifier" option with "[]" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"syntax":1}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.stringifier should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.stringifier should be a string.
- * options.stringifier should be an object:
- object { … }
- * options.stringifier should be an instance of function."
+ * options.postcssOptions.syntax should be one of these:
+ string | object { … }
+ -> Allows to specify custom Postcss Syntax (https://github.com/postcss/postcss-loader#syntax)
+ Details:
+ * options.postcssOptions.syntax should be a string.
+ * options.postcssOptions.syntax should be an object:
+ object { … }"
`;
-exports[`validate options should throw an error on the "stringifier" option with "1" value 1`] = `
+exports[`validate options should throw an error on the "postcssOptions" option with "{"syntax":true}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.stringifier should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)
+ - options.postcssOptions should be one of these:
+ object { config?, parser?, syntax?, stringifier?, plugins?, … } | function
+ -> Options to pass through to \`Postcss\`.
Details:
- * options.stringifier should be a string.
- * options.stringifier should be an object:
- object { … }
- * options.stringifier should be an instance of function."
+ * options.postcssOptions.syntax should be one of these:
+ string | object { … }
+ -> Allows to specify custom Postcss Syntax (https://github.com/postcss/postcss-loader#syntax)
+ Details:
+ * options.postcssOptions.syntax should be a string.
+ * options.postcssOptions.syntax should be an object:
+ object { … }"
`;
-exports[`validate options should throw an error on the "stringifier" option with "false" value 1`] = `
-"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.stringifier should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)
- Details:
- * options.stringifier should be a string.
- * options.stringifier should be an object:
- object { … }
- * options.stringifier should be an instance of function."
-`;
-
-exports[`validate options should throw an error on the "stringifier" option with "true" value 1`] = `
-"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.stringifier should be one of these:
- string | object { … } | function
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#stringifier)
- Details:
- * options.stringifier should be a string.
- * options.stringifier should be an object:
- object { … }
- * options.stringifier should be an instance of function."
-`;
-
-exports[`validate options should throw an error on the "syntax" option with "[]" value 1`] = `
+exports[`validate options should throw an error on the "sourceMap" option with "/test/" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.syntax should be one of these:
- string | object { … }
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)
+ - options.sourceMap should be one of these:
+ string | boolean
+ -> Enables/Disables generation of source maps (https://github.com/postcss/postcss-loader#sourcemap)
Details:
- * options.syntax should be a string.
- * options.syntax should be an object:
- object { … }"
+ * options.sourceMap should be a string.
+ * options.sourceMap should be a boolean."
`;
-exports[`validate options should throw an error on the "syntax" option with "1" value 1`] = `
+exports[`validate options should throw an error on the "sourceMap" option with "[]" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.syntax should be one of these:
- string | object { … }
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)
+ - options.sourceMap should be one of these:
+ string | boolean
+ -> Enables/Disables generation of source maps (https://github.com/postcss/postcss-loader#sourcemap)
Details:
- * options.syntax should be a string.
- * options.syntax should be an object:
- object { … }"
+ * options.sourceMap should be a string.
+ * options.sourceMap should be a boolean."
`;
-exports[`validate options should throw an error on the "syntax" option with "false" value 1`] = `
+exports[`validate options should throw an error on the "sourceMap" option with "{}" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.syntax should be one of these:
- string | object { … }
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)
+ - options.sourceMap should be one of these:
+ string | boolean
+ -> Enables/Disables generation of source maps (https://github.com/postcss/postcss-loader#sourcemap)
Details:
- * options.syntax should be a string.
- * options.syntax should be an object:
- object { … }"
+ * options.sourceMap should be a string.
+ * options.sourceMap should be a boolean."
`;
-exports[`validate options should throw an error on the "syntax" option with "true" value 1`] = `
+exports[`validate options should throw an error on the "sourceMap" option with "1" value 1`] = `
"Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- - options.syntax should be one of these:
- string | object { … }
- -> should be {String|Object} (https://github.com/postcss/postcss-loader#syntax)
+ - options.sourceMap should be one of these:
+ string | boolean
+ -> Enables/Disables generation of source maps (https://github.com/postcss/postcss-loader#sourcemap)
Details:
- * options.syntax should be a string.
- * options.syntax should be an object:
- object { … }"
+ * options.sourceMap should be a string.
+ * options.sourceMap should be a boolean."
`;
diff --git a/test/config-autoload.test.js b/test/config-autoload.test.js
index 9c9c795b..5c5ee967 100644
--- a/test/config-autoload.test.js
+++ b/test/config-autoload.test.js
@@ -23,9 +23,7 @@ describe('config-autoload', () => {
expect(config.map).toEqual(false);
expect(config.from).toEqual('./test/rc/fixtures/index.css');
expect(config.to).toEqual('./test/rc/expect/index.css');
-
expect(Object.keys(config.plugins).length).toEqual(3);
-
expect(config.file).toEqual(
path.resolve(testDirectory, 'rc', '.postcssrc')
);
@@ -46,9 +44,7 @@ describe('config-autoload', () => {
expect(config.map).toEqual(false);
expect(config.from).toEqual('./test/js/object/fixtures/index.css');
expect(config.to).toEqual('./test/js/object/expect/index.css');
-
expect(Object.keys(config.plugins).length).toEqual(3);
-
expect(config.file).toEqual(
path.resolve(testDirectory, 'js/object', 'postcss.config.js')
);
@@ -69,9 +65,7 @@ describe('config-autoload', () => {
expect(config.map).toEqual(false);
expect(config.from).toEqual('./test/js/array/fixtures/index.css');
expect(config.to).toEqual('./test/js/array/expect/index.css');
-
expect(Object.keys(config.plugins).length).toEqual(3);
-
expect(config.file).toEqual(
path.resolve(testDirectory, 'js/array', 'postcss.config.js')
);
@@ -95,7 +89,6 @@ describe('config-autoload', () => {
expect(config.from).toEqual('./test/pkg/fixtures/index.css');
expect(config.to).toEqual('./test/pkg/expect/index.css');
expect(Object.keys(config.plugins).length).toEqual(3);
-
expect(config.file).toEqual(
path.resolve(testDirectory, 'pkg', 'package.json')
);
diff --git a/test/fixtures/config-autoload/err/options/parser/.postcssrc.js b/test/fixtures/config-autoload/err/options/parser/.postcssrc.js
index b6a9703b..dba61ac0 100644
--- a/test/fixtures/config-autoload/err/options/parser/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/options/parser/.postcssrc.js
@@ -1,5 +1,5 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
parser: 'postcss-parser'
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/options/stringifier/.postcssrc.js b/test/fixtures/config-autoload/err/options/stringifier/.postcssrc.js
index f95f7882..390663f2 100644
--- a/test/fixtures/config-autoload/err/options/stringifier/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/options/stringifier/.postcssrc.js
@@ -1,5 +1,5 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
stringifier: 'postcss-stringifier'
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/options/syntax/.postcssrc.js b/test/fixtures/config-autoload/err/options/syntax/.postcssrc.js
index 7f47a489..4804efcf 100644
--- a/test/fixtures/config-autoload/err/options/syntax/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/options/syntax/.postcssrc.js
@@ -1,5 +1,5 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
syntax: 'postcss-syntax'
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/.postcssrc.js b/test/fixtures/config-autoload/err/plugins/.postcssrc.js
index cc5ec151..c1f976e1 100644
--- a/test/fixtures/config-autoload/err/plugins/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/plugins/.postcssrc.js
@@ -1,7 +1,7 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
plugins: [
require('./plugin')
]
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/array/.postcssrc.js b/test/fixtures/config-autoload/err/plugins/array/.postcssrc.js
index 4af98644..96637a16 100644
--- a/test/fixtures/config-autoload/err/plugins/array/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/plugins/array/.postcssrc.js
@@ -1,7 +1,7 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
plugins: [
require('postcss-plugin')
]
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/array/options/.postcssrc.js b/test/fixtures/config-autoload/err/plugins/array/options/.postcssrc.js
index 4af98644..96637a16 100644
--- a/test/fixtures/config-autoload/err/plugins/array/options/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/plugins/array/options/.postcssrc.js
@@ -1,7 +1,7 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
plugins: [
require('postcss-plugin')
]
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/object/.postcssrc.js b/test/fixtures/config-autoload/err/plugins/object/.postcssrc.js
index e448bacb..a89a9768 100644
--- a/test/fixtures/config-autoload/err/plugins/object/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/plugins/object/.postcssrc.js
@@ -1,7 +1,7 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
plugins: {
'postcss-plugin': {}
}
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/object/options/.postcssrc.js b/test/fixtures/config-autoload/err/plugins/object/options/.postcssrc.js
index 2ed3c923..5985c978 100644
--- a/test/fixtures/config-autoload/err/plugins/object/options/.postcssrc.js
+++ b/test/fixtures/config-autoload/err/plugins/object/options/.postcssrc.js
@@ -1,7 +1,7 @@
-module.exports = function (ctx) {
+module.exports = function () {
return {
plugins: {
'postcss-plugin': { option: true }
}
}
-}
+};
diff --git a/test/fixtures/config-autoload/err/plugins/plugin.js b/test/fixtures/config-autoload/err/plugins/plugin.js
index 2a02d19d..8f7026e5 100644
--- a/test/fixtures/config-autoload/err/plugins/plugin.js
+++ b/test/fixtures/config-autoload/err/plugins/plugin.js
@@ -1 +1 @@
-module.exports = 'Invalid Plugin'
+module.exports = 'Invalid Plugin';
diff --git a/test/fixtures/config-autoload/js/array/postcss.config.js b/test/fixtures/config-autoload/js/array/postcss.config.js
index dd765570..2ba80139 100644
--- a/test/fixtures/config-autoload/js/array/postcss.config.js
+++ b/test/fixtures/config-autoload/js/array/postcss.config.js
@@ -11,4 +11,4 @@ module.exports = function (ctx) {
ctx.env === 'production' ? require('cssnano')() : false
]
}
-}
+};
diff --git a/test/fixtures/config-autoload/js/object/postcss.config.js b/test/fixtures/config-autoload/js/object/postcss.config.js
index 0ae4544f..a2af44e3 100644
--- a/test/fixtures/config-autoload/js/object/postcss.config.js
+++ b/test/fixtures/config-autoload/js/object/postcss.config.js
@@ -8,7 +8,7 @@ module.exports = function (ctx) {
plugins: {
'postcss-import': {},
'postcss-nested': {},
- 'cssnano': ctx.env === 'production' ? {} : false,
+ 'cssnano': ctx.env === 'production' ? {} : false
}
}
-}
+};
diff --git a/test/fixtures/config-scope/config/context/postcss.config.js b/test/fixtures/config-scope/config/context/postcss.config.js
index 4ba08736..5499c260 100644
--- a/test/fixtures/config-scope/config/context/postcss.config.js
+++ b/test/fixtures/config-scope/config/context/postcss.config.js
@@ -2,4 +2,4 @@ module.exports = (ctx) => ({
plugins: [
require('./plugin')(ctx)
]
-})
+});
diff --git a/test/fixtures/config-scope/config/plugin.js b/test/fixtures/config-scope/config/plugin.js
index eefb142e..ac15c380 100644
--- a/test/fixtures/config-scope/config/plugin.js
+++ b/test/fixtures/config-scope/config/plugin.js
@@ -1,9 +1,9 @@
-'use strict'
+'use strict';
-const postcss = require('postcss')
+const postcss = require('postcss');
module.exports = postcss.plugin('plugin', (options) => {
- options = Object.assign({ alpha: '1.0' }, options)
+ options = Object.assign({ alpha: '1.0' }, options);
return (css, result) => {
css.walkDecls((decl) => {
@@ -12,4 +12,4 @@ module.exports = postcss.plugin('plugin', (options) => {
}
})
}
-})
+});
diff --git a/test/fixtures/config-scope/config/postcss.config.js b/test/fixtures/config-scope/config/postcss.config.js
index 142dbaaa..3e112aca 100644
--- a/test/fixtures/config-scope/config/postcss.config.js
+++ b/test/fixtures/config-scope/config/postcss.config.js
@@ -2,4 +2,5 @@ module.exports = (ctx) => ({
plugins: [
ctx.options.plugin ? require('./plugin')() : false
]
-})
+});
+
diff --git a/test/fixtures/config-scope/css/custom.config.js b/test/fixtures/config-scope/css/custom.config.js
index c43eeee8..5f32d855 100644
--- a/test/fixtures/config-scope/css/custom.config.js
+++ b/test/fixtures/config-scope/css/custom.config.js
@@ -2,4 +2,5 @@ module.exports = {
plugins: [
require('../config/plugin')()
]
-}
+};
+
diff --git a/test/fixtures/config-scope/css/plugins.config.js b/test/fixtures/config-scope/css/plugins.config.js
index 47734fec..fbdf6676 100644
--- a/test/fixtures/config-scope/css/plugins.config.js
+++ b/test/fixtures/config-scope/css/plugins.config.js
@@ -4,4 +4,4 @@ module.exports = {
'postcss-import': {},
'postcss-nested': {},
}
-}
+};
diff --git a/test/fixtures/config-scope/postcss.config.js b/test/fixtures/config-scope/postcss.config.js
index 51eec6b3..3a4e2b4a 100644
--- a/test/fixtures/config-scope/postcss.config.js
+++ b/test/fixtures/config-scope/postcss.config.js
@@ -2,4 +2,5 @@ module.exports = {
plugins: [
require('./config/plugin')()
]
-}
+};
+
diff --git a/test/fixtures/css/index.js b/test/fixtures/css/index.js
index 61e122b2..10eb08e3 100644
--- a/test/fixtures/css/index.js
+++ b/test/fixtures/css/index.js
@@ -1,3 +1,3 @@
-import style from './style.css'
+import style from './style.css';
-export default style
+export default style;
diff --git a/test/fixtures/css/index2.js b/test/fixtures/css/index2.js
index 9415e9b0..ad0ddaa0 100644
--- a/test/fixtures/css/index2.js
+++ b/test/fixtures/css/index2.js
@@ -1,3 +1,3 @@
-import style from './style2.css'
+import style from './style2.css';
-export default style
+export default style;
diff --git a/test/fixtures/css/plugins.config.js b/test/fixtures/css/plugins.config.js
index 47734fec..fbdf6676 100644
--- a/test/fixtures/css/plugins.config.js
+++ b/test/fixtures/css/plugins.config.js
@@ -4,4 +4,4 @@ module.exports = {
'postcss-import': {},
'postcss-nested': {},
}
-}
+};
diff --git a/test/fixtures/jss/exec/index.js b/test/fixtures/jss/exec/index.js
index d35eec3f..b8ca99c8 100644
--- a/test/fixtures/jss/exec/index.js
+++ b/test/fixtures/jss/exec/index.js
@@ -1,3 +1,3 @@
-import style from './style.exec.js'
+import style from './style.exec.js';
-export default style
+export default style;
diff --git a/test/fixtures/jss/exec/style.exec.js b/test/fixtures/jss/exec/style.exec.js
index 5d4ed665..f0175724 100644
--- a/test/fixtures/jss/exec/style.exec.js
+++ b/test/fixtures/jss/exec/style.exec.js
@@ -1,11 +1,11 @@
-'use strict'
+'use strict';
-const postcssJS = require('postcss-js')
+const postcssJS = require('postcss-js');
const style = {
a: {
color: 'green'
}
-}
+};
-module.exports = postcssJS.parse(style)
+module.exports = postcssJS.parse(style);
diff --git a/test/loader.test.js b/test/loader.test.js
index bb5eef3d..0afed5d3 100644
--- a/test/loader.test.js
+++ b/test/loader.test.js
@@ -11,7 +11,9 @@ import {
describe('loader', () => {
it('should work', async () => {
const compiler = getCompiler('./css/index.js', {
- plugins: [],
+ postcssOptions: {
+ plugins: [],
+ },
config: false,
});
const stats = await compile(compiler);
@@ -33,7 +35,9 @@ describe('loader', () => {
const postcssPlugin = postcss.plugin('postcss-plugin', plugin);
const compiler = getCompiler('./css/index.js', {
- plugins: [postcssPlugin()],
+ postcssOptions: {
+ plugins: [postcssPlugin()],
+ },
config: false,
});
const stats = await compile(compiler);
@@ -47,7 +51,9 @@ describe('loader', () => {
it('should emit Syntax Error', async () => {
const compiler = getCompiler('./css/index.js', {
- parser: 'sugarss',
+ postcssOptions: {
+ parser: 'sugarss',
+ },
config: false,
});
const stats = await compile(compiler);
@@ -69,7 +75,9 @@ describe('loader', () => {
const postcssPlugin = postcss.plugin('postcss-assets', plugin);
const compiler = getCompiler('./css/index.js', {
- plugins: [postcssPlugin()],
+ postcssOptions: {
+ plugins: [postcssPlugin()],
+ },
config: false,
});
const stats = await compile(compiler);
diff --git a/test/options/__snapshots__/plugins.test.js.snap b/test/options/__snapshots__/plugins.test.js.snap
index fb623cac..43bf7600 100644
--- a/test/options/__snapshots__/plugins.test.js.snap
+++ b/test/options/__snapshots__/plugins.test.js.snap
@@ -1,5 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`Options Plugins should disables plugin from config: css 1`] = `
+"a {
+ -x-border-color: blue blue *;
+ -x-color: * #fafafa;
+}
+"
+`;
+
+exports[`Options Plugins should disables plugin from config: errors 1`] = `Array []`;
+
+exports[`Options Plugins should disables plugin from config: warnings 1`] = `Array []`;
+
exports[`Options Plugins should emit error on load plugin: errors 1`] = `
Array [
"ModuleBuildError: Module build failed (from \`replaced original path\`):
@@ -11,26 +23,10 @@ Loading PostCSS Plugin failed: Cannot find module 'postcss-unresolved' from 'src
exports[`Options Plugins should emit error on load plugin: warnings 1`] = `Array []`;
-exports[`Options Plugins should not disables plugin from config: css 1`] = `
-"a {
- border-top-color: blue;
- border-right-color: blue;
- border-left-color: blue;
- background-color: #fafafa;
-}
-"
-`;
-
-exports[`Options Plugins should not disables plugin from config: errors 1`] = `Array []`;
-
-exports[`Options Plugins should not disables plugin from config: warnings 1`] = `Array []`;
-
exports[`Options Plugins should work Plugins - { Array } Array + options: css 1`] = `
"a {
- border-top-color: blue;
- border-right-color: blue;
- border-left-color: blue;
- background-color: #fafafa;
+ -x-border-color: blue blue *;
+ -x-color: * #fafafa;
}
"
`;
@@ -39,20 +35,6 @@ exports[`Options Plugins should work Plugins - { Array } Array + options: errors
exports[`Options Plugins should work Plugins - { Array } Array + options: warnings 1`] = `Array []`;
-exports[`Options Plugins should work Plugins - { Function } Array + options: css 1`] = `
-"a {
- border-top-color: blue;
- border-right-color: blue;
- border-left-color: blue;
- background-color: #fafafa;
-}
-"
-`;
-
-exports[`Options Plugins should work Plugins - { Function } Array + options: errors 1`] = `Array []`;
-
-exports[`Options Plugins should work Plugins - { Function } Array + options: warnings 1`] = `Array []`;
-
exports[`Options Plugins should work Plugins - {Array