postcss-normalize-repeat-style 5.0.0-rc.2 → 5.0.3

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
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
9
9
 
10
- var _cssnanoUtils = require("cssnano-utils");
11
-
12
10
  var _map = _interopRequireDefault(require("./lib/map"));
13
11
 
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -17,9 +15,7 @@ function evenValues(list, index) {
17
15
  return index % 2 === 0;
18
16
  }
19
17
 
20
- const repeatKeywords = _map.default.map(mapping => mapping[0]);
21
-
22
- const getMatch = (0, _cssnanoUtils.getMatch)(_map.default);
18
+ const repeatKeywords = new Set(_map.default.values());
23
19
 
24
20
  function isCommaNode(node) {
25
21
  return node.type === 'div' && node.value === ',';
@@ -77,7 +73,7 @@ function transform(value) {
77
73
  return;
78
74
  }
79
75
 
80
- const isRepeatKeyword = node.type === 'word' && repeatKeywords.includes(node.value.toLowerCase());
76
+ const isRepeatKeyword = node.type === 'word' && repeatKeywords.has(node.value.toLowerCase());
81
77
 
82
78
  if (ranges[rangeIndex].start === null && isRepeatKeyword) {
83
79
  ranges[rangeIndex].start = index;
@@ -107,7 +103,9 @@ function transform(value) {
107
103
  return;
108
104
  }
109
105
 
110
- const match = getMatch(nodes.filter(evenValues).map(n => n.value.toLowerCase()));
106
+ const key = nodes.filter(evenValues).map(n => n.value.toLowerCase()).toString();
107
+
108
+ const match = _map.default.get(key);
111
109
 
112
110
  if (match) {
113
111
  nodes[0].value = match;
@@ -122,7 +120,7 @@ function pluginCreator() {
122
120
  postcssPlugin: 'postcss-normalize-repeat-style',
123
121
 
124
122
  prepare() {
125
- const cache = {};
123
+ const cache = new Map();
126
124
  return {
127
125
  OnceExit(css) {
128
126
  css.walkDecls(/^(background(-repeat)?|(-\w+-)?mask-repeat)$/i, decl => {
@@ -132,14 +130,14 @@ function pluginCreator() {
132
130
  return;
133
131
  }
134
132
 
135
- if (cache[value]) {
136
- decl.value = cache[value];
133
+ if (cache.has(value)) {
134
+ decl.value = cache.get(value);
137
135
  return;
138
136
  }
139
137
 
140
138
  const result = transform(value);
141
139
  decl.value = result;
142
- cache[value] = result;
140
+ cache.set(value, result);
143
141
  });
144
142
  }
145
143
 
package/dist/lib/map.js CHANGED
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = [['repeat-x', ['repeat', 'no-repeat']], ['repeat-y', ['no-repeat', 'repeat']], ['repeat', ['repeat', 'repeat']], ['space', ['space', 'space']], ['round', ['round', 'round']], ['no-repeat', ['no-repeat', 'no-repeat']]];
7
+
8
+ var _default = new Map([[['repeat', 'no-repeat'].toString(), 'repeat-x'], [['no-repeat', 'repeat'].toString(), 'repeat-y'], [['repeat', 'repeat'].toString(), 'repeat'], [['space', 'space'].toString(), 'space'], [['round', 'round'].toString(), 'round'], [['no-repeat', 'no-repeat'].toString(), 'no-repeat']]);
9
+
8
10
  exports.default = _default;
9
11
  module.exports = exports.default;
package/package.json CHANGED
@@ -1,21 +1,15 @@
1
1
  {
2
2
  "name": "postcss-normalize-repeat-style",
3
- "version": "5.0.0-rc.2",
3
+ "version": "5.0.3",
4
4
  "description": "Convert two value syntax for repeat-style into one value.",
5
5
  "main": "dist/index.js",
6
- "scripts": {
7
- "prebuild": "del-cli dist",
8
- "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
9
- "prepublish": "yarn build"
10
- },
11
6
  "files": [
12
7
  "LICENSE-MIT",
13
8
  "dist"
14
9
  ],
15
10
  "license": "MIT",
16
11
  "dependencies": {
17
- "cssnano-utils": "^2.0.0-rc.2",
18
- "postcss-value-parser": "^4.1.0"
12
+ "postcss-value-parser": "^4.2.0"
19
13
  },
20
14
  "author": {
21
15
  "name": "Ben Briggs",
@@ -31,10 +25,14 @@
31
25
  "node": "^10 || ^12 || >=14.0"
32
26
  },
33
27
  "devDependencies": {
34
- "postcss": "^8.2.1"
28
+ "postcss": "^8.2.15"
35
29
  },
36
30
  "peerDependencies": {
37
- "postcss": "^8.2.1"
31
+ "postcss": "^8.2.15"
32
+ },
33
+ "scripts": {
34
+ "prebuild": "rimraf dist",
35
+ "build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
38
36
  },
39
- "gitHead": "5ba19ca54892f76ba6b2b698b4d88adcabd4451b"
40
- }
37
+ "readme": "# [postcss][postcss]-normalize-repeat-style\n\n> Normalize repeat styles with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-normalize-repeat-style) do:\n\n```\nnpm install postcss-normalize-repeat-style --save\n```\n\n## Example\n\n### Input\n\n```css\nh1 {\n background: url(image.jpg) repeat no-repeat\n}\n```\n\n### Output\n\n```css\nh1 {\n background: url(image.jpg) repeat-x\n}\n```\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
38
+ }
package/CHANGELOG.md DELETED
@@ -1,61 +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.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-normalize-repeat-style@5.0.0-rc.1...postcss-normalize-repeat-style@5.0.0-rc.2) (2021-03-15)
7
-
8
- **Note:** Version bump only for package postcss-normalize-repeat-style
9
-
10
-
11
-
12
-
13
-
14
- # [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-normalize-repeat-style@5.0.0-rc.0...postcss-normalize-repeat-style@5.0.0-rc.1) (2021-03-04)
15
-
16
- **Note:** Version bump only for package postcss-normalize-repeat-style
17
-
18
-
19
-
20
-
21
-
22
- # 5.0.0-rc.0 (2021-02-19)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * **postcss-normalize-repeat-style:** better handle css variables ([#753](https://github.com/cssnano/cssnano/issues/753)) ([7e18b0c](https://github.com/cssnano/cssnano/commit/7e18b0cbcd7cb5de58e60ab4ef1900a4d8eeefec))
28
-
29
-
30
- ### chore
31
-
32
- * minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
33
-
34
-
35
- ### Features
36
-
37
- * migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
38
-
39
-
40
- ### BREAKING CHANGES
41
-
42
- * minimum supported `postcss` version is `8.2.1`
43
- * minimum require version of node is 10.13
44
-
45
-
46
-
47
- ## 4.1.9 (2019-02-12)
48
-
49
-
50
- ### Performance Improvements
51
-
52
- * **postcss-normalize-repeat-style:** increase perf ([#690](https://github.com/cssnano/cssnano/issues/690)) ([2c900e4](https://github.com/cssnano/cssnano/commit/2c900e4176e4aabd484e468b32b1ed1011c00ef4))
53
-
54
-
55
-
56
- ## 4.1.1 (2018-09-24)
57
-
58
-
59
- ### Bug Fixes
60
-
61
- * **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)