postcss-discard-comments 5.0.1 → 5.0.2

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.
package/dist/index.js CHANGED
@@ -13,24 +13,24 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  function pluginCreator(opts = {}) {
15
15
  const remover = new _commentRemover.default(opts);
16
- const matcherCache = {};
17
- const replacerCache = {};
16
+ const matcherCache = new Map();
17
+ const replacerCache = new Map();
18
18
 
19
19
  function matchesComments(source) {
20
- if (matcherCache[source]) {
21
- return matcherCache[source];
20
+ if (matcherCache.has(source)) {
21
+ return matcherCache.get(source);
22
22
  }
23
23
 
24
24
  const result = (0, _commentParser.default)(source).filter(([type]) => type);
25
- matcherCache[source] = result;
25
+ matcherCache.set(source, result);
26
26
  return result;
27
27
  }
28
28
 
29
29
  function replaceComments(source, space, separator = ' ') {
30
30
  const key = source + '@|@' + separator;
31
31
 
32
- if (replacerCache[key]) {
33
- return replacerCache[key];
32
+ if (replacerCache.has(key)) {
33
+ return replacerCache.get(key);
34
34
  }
35
35
 
36
36
  const parsed = (0, _commentParser.default)(source).reduce((value, [type, start, end]) => {
@@ -47,7 +47,7 @@ function pluginCreator(opts = {}) {
47
47
  return `${value}/*${contents}*/`;
48
48
  }, '');
49
49
  const result = space(parsed).join(' ');
50
- replacerCache[key] = result;
50
+ replacerCache.set(key, result);
51
51
  return result;
52
52
  }
53
53
 
package/package.json CHANGED
@@ -1,17 +1,12 @@
1
1
  {
2
2
  "name": "postcss-discard-comments",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Discard comments in your CSS files with PostCSS.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",
8
8
  "LICENSE-MIT"
9
9
  ],
10
- "scripts": {
11
- "prebuild": "del-cli dist",
12
- "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
13
- "prepublish": "yarn build"
14
- },
15
10
  "keywords": [
16
11
  "css",
17
12
  "comments",
@@ -38,5 +33,9 @@
38
33
  "peerDependencies": {
39
34
  "postcss": "^8.2.15"
40
35
  },
41
- "gitHead": "28c247175032fa03f04911cde56ad82d74d211cc"
42
- }
36
+ "scripts": {
37
+ "prebuild": "rimraf dist",
38
+ "build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
39
+ },
40
+ "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"
41
+ }
package/CHANGELOG.md DELETED
@@ -1,72 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [5.0.1](https://github.com/cssnano/cssnano/compare/postcss-discard-comments@5.0.0...postcss-discard-comments@5.0.1) (2021-05-19)
7
-
8
- **Note:** Version bump only for package postcss-discard-comments
9
-
10
-
11
-
12
-
13
-
14
- # [5.0.0](https://github.com/cssnano/cssnano/compare/postcss-discard-comments@5.0.0-rc.2...postcss-discard-comments@5.0.0) (2021-04-06)
15
-
16
- **Note:** Version bump only for package postcss-discard-comments
17
-
18
-
19
-
20
-
21
-
22
- # [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-discard-comments@5.0.0-rc.1...postcss-discard-comments@5.0.0-rc.2) (2021-03-15)
23
-
24
- **Note:** Version bump only for package postcss-discard-comments
25
-
26
-
27
-
28
-
29
-
30
- # [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-discard-comments@5.0.0-rc.0...postcss-discard-comments@5.0.0-rc.1) (2021-03-04)
31
-
32
- **Note:** Version bump only for package postcss-discard-comments
33
-
34
-
35
-
36
-
37
-
38
- # 5.0.0-rc.0 (2021-02-19)
39
-
40
-
41
- ### chore
42
-
43
- * minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
44
-
45
-
46
- ### Features
47
-
48
- * migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
49
-
50
-
51
- ### BREAKING CHANGES
52
-
53
- * minimum supported `postcss` version is `8.2.1`
54
- * minimum require version of node is 10.13
55
-
56
-
57
-
58
- ## 4.1.9 (2019-02-12)
59
-
60
-
61
- ### Performance Improvements
62
-
63
- * **postcss-discard-comments:** increase perf ([#700](https://github.com/cssnano/cssnano/issues/700)) ([84294e9](https://github.com/cssnano/cssnano/commit/84294e97da82bd2fb5cf9299f0a9dc4441c8d70c))
64
-
65
-
66
-
67
- ## 4.1.1 (2018-09-24)
68
-
69
-
70
- ### Bug Fixes
71
-
72
- * **postcss-merge-longhand:** not mangle border output ([#555](https://github.com/cssnano/cssnano/issues/555)) ([9a70605](https://github.com/cssnano/cssnano/commit/9a706050b621e7795a9bf74eb7110b5c81804ffe)), closes [#553](https://github.com/cssnano/cssnano/issues/553) [#554](https://github.com/cssnano/cssnano/issues/554)