You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.0 KiB
JavaScript

"use strict";
const { validateValue } = require("@validatem/core");
const postcssNested = require("postcss-nested");
const postcssNestedProps = require("postcss-nested-props");
const isPostCSSPlugin = require("./");
/* Plugin (factory), PostCSS <= 7 */
console.log(validateValue(postcssNestedProps, [ isPostCSSPlugin ])); // { process: [Function (anonymous)] }
/* Plugin function (instance), PostCSS <= 7 */
console.log(validateValue(postcssNestedProps(), [ isPostCSSPlugin ])); // { postcssPlugin: 'postcss-nested-props', postcssVersion: '6.0.23' }
/* Plugin (factory), PostCSS 8 */
console.log(validateValue(postcssNested, [ isPostCSSPlugin ])); // [Function (anonymous)] { postcss: true }
/* Plugin function (instance), PostCSS 8 */
console.log(validateValue(postcssNested(), [ isPostCSSPlugin ])); // { postcssPlugin: 'postcss-nested', Rule: [Function: Rule] }
console.log(validateValue("hello world", [ isPostCSSPlugin ])); /*
AggregrateValidationError: One or more validation errors occurred:
- At (root): Must be a PostCSS plugin
*/