postcss-minify-gradients 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
@@ -9,13 +9,13 @@ 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
 
16
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
 
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
20
  const angles = {
21
21
  top: '0deg',
@@ -62,7 +62,7 @@ function optimise(decl) {
62
62
 
63
63
  let lastStop = null;
64
64
  args.forEach((arg, index) => {
65
- if (!arg[2]) {
65
+ if (arg.length !== 3) {
66
66
  return;
67
67
  }
68
68
 
@@ -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.0-rc.2",
3
+ "version": "5.0.3",
4
4
  "description": "Minify gradient parameters with PostCSS.",
5
5
  "main": "dist/index.js",
6
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"
7
+ "prebuild": "rimraf dist",
8
+ "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
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
- "cssnano-utils": "^2.0.0-rc.2",
30
- "is-color-stop": "^1.1.0",
29
+ "colord": "^2.9.1",
30
+ "cssnano-utils": "^2.0.1",
31
31
  "postcss-value-parser": "^4.1.0"
32
32
  },
33
33
  "bugs": {
@@ -37,10 +37,10 @@
37
37
  "node": "^10 || ^12 || >=14.0"
38
38
  },
39
39
  "devDependencies": {
40
- "postcss": "^8.2.1"
40
+ "postcss": "^8.2.15"
41
41
  },
42
42
  "peerDependencies": {
43
- "postcss": "^8.2.1"
43
+ "postcss": "^8.2.15"
44
44
  },
45
- "gitHead": "5ba19ca54892f76ba6b2b698b4d88adcabd4451b"
45
+ "gitHead": "2d84646671c7075f8dae35de310351aac3436bc0"
46
46
  }
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-minify-gradients@5.0.0-rc.1...postcss-minify-gradients@5.0.0-rc.2) (2021-03-15)
7
-
8
- **Note:** Version bump only for package postcss-minify-gradients
9
-
10
-
11
-
12
-
13
-
14
- # [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)
15
-
16
- **Note:** Version bump only for package postcss-minify-gradients
17
-
18
-
19
-
20
-
21
-
22
- # 5.0.0-rc.0 (2021-02-19)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * **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))
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
- ### Bug Fixes
51
-
52
- * **postcss-minify-gradients:** handle uppercase ([#706](https://github.com/cssnano/cssnano/issues/706)) ([acd5d0e](https://github.com/cssnano/cssnano/commit/acd5d0eb59e76fe62b70faad89d6ee0f76f798ef))
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)