postcss-minify-gradients 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
@@ -9,7 +9,7 @@ var _postcssValueParser = _interopRequireWildcard(require("postcss-value-parser"
9
9
 
10
10
  var _cssnanoUtils = require("cssnano-utils");
11
11
 
12
- var _isColorStop = _interopRequireDefault(require("is-color-stop"));
12
+ var _isColorStop = _interopRequireDefault(require("./isColorStop.js"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = isColorStop;
7
+
8
+ var _postcssValueParser = require("postcss-value-parser");
9
+
10
+ var _colord = require("colord");
11
+
12
+ var _names = _interopRequireDefault(require("colord/plugins/names"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ (0, _colord.extend)([_names.default]);
17
+ /* Code derived from https://github.com/pigcan/is-color-stop */
18
+
19
+ const lengthArray = ['PX', 'IN', 'CM', 'MM', 'EM', 'REM', 'POINTS', 'PC', 'EX', 'CH', 'VW', 'VH', 'VMIN', 'VMAX', '%'];
20
+
21
+ function isCSSLengthUnit(input) {
22
+ return lengthArray.includes(input.toUpperCase());
23
+ }
24
+
25
+ function isStop(str) {
26
+ let stop = !str;
27
+
28
+ if (!stop) {
29
+ const node = (0, _postcssValueParser.unit)(str);
30
+
31
+ if (node) {
32
+ if (node.number === 0 || !isNaN(node.number) && isCSSLengthUnit(node.unit)) {
33
+ stop = true;
34
+ }
35
+ } else {
36
+ stop = /^calc\(\S+\)$/g.test(str);
37
+ }
38
+ }
39
+
40
+ return stop;
41
+ }
42
+
43
+ function isColorStop(color, stop) {
44
+ return (0, _colord.colord)(color).isValid() && isStop(stop);
45
+ }
46
+
47
+ module.exports = exports.default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "postcss-minify-gradients",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Minify gradient parameters with PostCSS.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "prebuild": "del-cli dist",
7
+ "prebuild": "rimraf dist",
8
8
  "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
9
- "prepublish": "yarn build"
9
+ "prepare": "yarn build"
10
10
  },
11
11
  "files": [
12
12
  "LICENSE-MIT",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "repository": "cssnano/cssnano",
28
28
  "dependencies": {
29
+ "colord": "^2.6",
29
30
  "cssnano-utils": "^2.0.1",
30
- "is-color-stop": "^1.1.0",
31
31
  "postcss-value-parser": "^4.1.0"
32
32
  },
33
33
  "bugs": {
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "postcss": "^8.2.15"
44
44
  },
45
- "gitHead": "28c247175032fa03f04911cde56ad82d74d211cc"
45
+ "gitHead": "3ffd3a0f178d60b68eeb84d75353b6decc6ef735"
46
46
  }
package/CHANGELOG.md DELETED
@@ -1,77 +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-minify-gradients@5.0.0...postcss-minify-gradients@5.0.1) (2021-05-19)
7
-
8
- **Note:** Version bump only for package postcss-minify-gradients
9
-
10
-
11
-
12
-
13
-
14
- # [5.0.0](https://github.com/cssnano/cssnano/compare/postcss-minify-gradients@5.0.0-rc.2...postcss-minify-gradients@5.0.0) (2021-04-06)
15
-
16
- **Note:** Version bump only for package postcss-minify-gradients
17
-
18
-
19
-
20
-
21
-
22
- # [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-minify-gradients@5.0.0-rc.1...postcss-minify-gradients@5.0.0-rc.2) (2021-03-15)
23
-
24
- **Note:** Version bump only for package postcss-minify-gradients
25
-
26
-
27
-
28
-
29
-
30
- # [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-minify-gradients@5.0.0-rc.0...postcss-minify-gradients@5.0.0-rc.1) (2021-03-04)
31
-
32
- **Note:** Version bump only for package postcss-minify-gradients
33
-
34
-
35
-
36
-
37
-
38
- # 5.0.0-rc.0 (2021-02-19)
39
-
40
-
41
- ### Bug Fixes
42
-
43
- * **postcss-minify-gradients:** don't break gradients with `var` and `env` functions ([#735](https://github.com/cssnano/cssnano/issues/735)) ([7fabd9d](https://github.com/cssnano/cssnano/commit/7fabd9d03c81142c5854d0c0a50bee15ed86c219))
44
-
45
-
46
- ### chore
47
-
48
- * minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
49
-
50
-
51
- ### Features
52
-
53
- * migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
54
-
55
-
56
- ### BREAKING CHANGES
57
-
58
- * minimum supported `postcss` version is `8.2.1`
59
- * minimum require version of node is 10.13
60
-
61
-
62
-
63
- ## 4.1.9 (2019-02-12)
64
-
65
-
66
- ### Bug Fixes
67
-
68
- * **postcss-minify-gradients:** handle uppercase ([#706](https://github.com/cssnano/cssnano/issues/706)) ([acd5d0e](https://github.com/cssnano/cssnano/commit/acd5d0eb59e76fe62b70faad89d6ee0f76f798ef))
69
-
70
-
71
-
72
- ## 4.1.1 (2018-09-24)
73
-
74
-
75
- ### Bug Fixes
76
-
77
- * **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)