Require PostCSS peer dependency from parser

This commit is contained in:
Andrey Sitnik
2021-06-13 13:41:57 -04:00
parent fb1894f7ee
commit bdeaa4543e
+6 -2
View File
@@ -39,8 +39,9 @@ A good example of a parser is [Safe Parser], which parses malformed/broken CSS.
Because there is no point to generate broken output, this package only provides
a parser.
The parser API is a function which receives a string & returns a [`Root`] or [`Document`] node.
The second argument is a function which receives an object with PostCSS options.
The parser API is a function which receives a string & returns a [`Root`]
or [`Document`] node. The second argument is a function which receives
an object with PostCSS options.
```js
const postcss = require('postcss')
@@ -52,6 +53,9 @@ module.exports = function parse (css, opts) {
}
```
For open source parser npm package must have `postcss` in `peerDependencies`,
not in direct `dependencies`.
[Safe Parser]: https://github.com/postcss/postcss-safe-parser
[`Root`]: https://postcss.org/api/#root
[`Document`]: https://postcss.org/api/#document