postcss-discard-comments 5.1.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +6 -5
  2. package/src/index.js +2 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-discard-comments",
3
- "version": "5.1.1",
3
+ "version": "6.0.0",
4
4
  "description": "Discard comments in your CSS files with PostCSS.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -27,13 +27,14 @@
27
27
  "url": "https://github.com/cssnano/cssnano/issues"
28
28
  },
29
29
  "engines": {
30
- "node": "^10 || ^12 || >=14.0"
30
+ "node": "^14 || ^16 || >=18.0"
31
31
  },
32
32
  "devDependencies": {
33
- "postcss": "^8.2.15"
33
+ "postcss": "^8.2.15",
34
+ "postcss-simple-vars": "^7.0.1",
35
+ "postcss-scss": "^4.0.6"
34
36
  },
35
37
  "peerDependencies": {
36
38
  "postcss": "^8.2.15"
37
- },
38
- "readme": "# [postcss][postcss]-discard-comments\n\n> Discard comments in your CSS files with PostCSS.\n\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-discard-comments) do:\n\n```\nnpm install postcss-discard-comments --save\n```\n\n\n## Example\n\n### Input\n\n```css\nh1/* heading */{\n margin: 0 auto\n}\n```\n\n### Output\n\n```css\nh1 {\n margin: 0 auto\n}\n```\n\nThis module discards comments from your CSS files; by default, it will remove\nall regular comments (`/* comment */`) and preserve comments marked as important\n(`/*! important */`).\n\nNote that this module does not handle source map comments because they are not\navailable to it; PostCSS handles this internally, so if they are removed then\nyou will have to [configure source maps in PostCSS][maps].\n\n[maps]: https://github.com/postcss/postcss/blob/master/docs/source-maps.md\n\n\n## API\n\n### comments([options])\n\n#### options\n\n##### remove(function)\n\nType: `function`\nReturn: `boolean`\nVariable: `comment` contains a comment without `/**/`\n\nFor each comment, return true to remove, or false to keep the comment.\n\n```js\nfunction(comment) {}\n```\n\n```js\nvar css = '/* headings *//*@ h1 */h1{margin:0 auto}/*@ h2 */h2{color:red}';\nconsole.log(postcss(comments({\n remove: function(comment) { return comment[0] == \"@\"; }\n})).process(css).css);\n//=> /* headings */h1{margin:0 auto}h2{color:red}\n```\n**NOTE:** If you use the `remove` function other options will not be available.\n\n##### removeAll\n\nType: `boolean`\nDefault: `false`\n\nRemove all comments marked as important.\n\n```js\nvar css = '/*! heading */h1{margin:0 auto}/*! heading 2 */h2{color:red}';\nconsole.log(postcss(comments({removeAll: true})).process(css).css);\n//=> h1{margin:0 auto}h2{color:red}\n```\n\n##### removeAllButFirst\n\nType: `boolean`\nDefault: `false`\n\nRemove all comments marked as important, but the first one.\n\n```js\nvar css = '/*! heading */h1{margin:0 auto}/*! heading 2 */h2{color:red}';\nconsole.log(postcss(comments({removeAllButFirst: true})).process(css).css);\n//=> /*! heading */h1{margin:0 auto}h2{color:red}\n```\n\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n\n[postcss]: https://github.com/postcss/postcss\n"
39
+ }
39
40
  }
package/src/index.js CHANGED
@@ -76,11 +76,8 @@ function pluginCreator(opts = {}) {
76
76
  return;
77
77
  }
78
78
 
79
- if (node.raws.between) {
80
- node.raws.between = replaceComments(
81
- /** @type {string} */ (node.raws.between),
82
- list.space
83
- );
79
+ if (typeof node.raws.between === 'string') {
80
+ node.raws.between = replaceComments(node.raws.between, list.space);
84
81
  }
85
82
 
86
83
  if (node.type === 'decl') {