autoprefixer 10.0.0 → 10.0.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 10.0.1
5
+ * Fix PostCSS 8.1 compatability.
6
+ * Add our OpenCollective to `package.json`.
7
+ * Clean up code (by Sukka).
8
+
4
9
  ## 10.0 “Alis volat propriis”
5
10
  * Removed support for Node.js 6.x, 8.x, 11.x.
6
11
  * Moved `postcss` to `peerDependencies`.
@@ -26,7 +26,7 @@ function isPlainObject (obj) {
26
26
  return Object.prototype.toString.apply(obj) === '[object Object]'
27
27
  }
28
28
 
29
- let cache = {}
29
+ let cache = new Map()
30
30
 
31
31
  function timeCapsule (result, prefixes) {
32
32
  if (prefixes.browsers.selected.length === 0) {
@@ -103,11 +103,11 @@ module.exports = (...reqs) => {
103
103
  let browsers = new Browsers(d.browsers, reqs, opts, brwlstOpts)
104
104
  let key = browsers.selected.join(', ') + JSON.stringify(options)
105
105
 
106
- if (!cache[key]) {
107
- cache[key] = new Prefixes(d.prefixes, browsers, options)
106
+ if (!cache.has(key)) {
107
+ cache.set(key, new Prefixes(d.prefixes, browsers, options))
108
108
  }
109
109
 
110
- return cache[key]
110
+ return cache.get(key)
111
111
  }
112
112
 
113
113
  return {
@@ -120,7 +120,7 @@ module.exports = (...reqs) => {
120
120
  })
121
121
 
122
122
  return {
123
- Root (root) {
123
+ Once (root) {
124
124
  timeCapsule(result, prefixes)
125
125
  if (options.remove !== false) {
126
126
  prefixes.processor.remove(root, result)
package/lib/prefixes.js CHANGED
@@ -65,7 +65,7 @@ Value.hack(require('./hacks/display-flex'))
65
65
  Value.hack(require('./hacks/display-grid'))
66
66
  Value.hack(require('./hacks/filter-value'))
67
67
 
68
- let declsCache = {}
68
+ let declsCache = new Map()
69
69
 
70
70
  class Prefixes {
71
71
  constructor (data, browsers, options = {}) {
@@ -267,14 +267,11 @@ class Prefixes {
267
267
  * Declaration loader with caching
268
268
  */
269
269
  decl (prop) {
270
- let decl = declsCache[prop]
271
-
272
- if (decl) {
273
- return decl
274
- } else {
275
- declsCache[prop] = Declaration.load(prop)
276
- return declsCache[prop]
270
+ if (!declsCache.has(prop)) {
271
+ declsCache.set(prop, Declaration.load(prop))
277
272
  }
273
+
274
+ return declsCache.get(prop)
278
275
  }
279
276
 
280
277
  /**
package/lib/selector.js CHANGED
@@ -8,7 +8,7 @@ let utils = require('./utils')
8
8
  class Selector extends Prefixer {
9
9
  constructor (name, prefixes, all) {
10
10
  super(name, prefixes, all)
11
- this.regexpCache = {}
11
+ this.regexpCache = new Map()
12
12
  }
13
13
 
14
14
  /**
@@ -33,16 +33,15 @@ class Selector extends Prefixer {
33
33
  * Lazy loadRegExp for name
34
34
  */
35
35
  regexp (prefix) {
36
- if (this.regexpCache[prefix]) {
37
- return this.regexpCache[prefix]
36
+ if (!this.regexpCache.has(prefix)) {
37
+ let name = prefix ? this.prefixed(prefix) : this.name
38
+ this.regexpCache.set(
39
+ prefix,
40
+ new RegExp(`(^|[^:"'=])${utils.escapeRegexp(name)}`, 'gi')
41
+ )
38
42
  }
39
43
 
40
- let name = prefix ? this.prefixed(prefix) : this.name
41
- this.regexpCache[prefix] = new RegExp(
42
- `(^|[^:"'=])${utils.escapeRegexp(name)}`,
43
- 'gi'
44
- )
45
- return this.regexpCache[prefix]
44
+ return this.regexpCache.get(prefix)
46
45
  }
47
46
 
48
47
  /**
package/lib/utils.js CHANGED
@@ -15,13 +15,7 @@ module.exports = {
15
15
  * Return array, that doesn’t contain duplicates.
16
16
  */
17
17
  uniq (array) {
18
- let filtered = []
19
- for (let i of array) {
20
- if (!filtered.includes(i)) {
21
- filtered.push(i)
22
- }
23
- }
24
- return filtered
18
+ return [...new Set(array)]
25
19
  },
26
20
 
27
21
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "10.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -15,18 +15,18 @@
15
15
  "main": "lib/autoprefixer.js",
16
16
  "bin": "bin/autoprefixer",
17
17
  "funding": {
18
- "type": "tidelift",
19
- "url": "https://tidelift.com/funding/github/npm/autoprefixer"
18
+ "type": "opencollective",
19
+ "url": "https://opencollective.com/postcss/"
20
20
  },
21
21
  "author": "Andrey Sitnik <andrey@sitnik.ru>",
22
22
  "license": "MIT",
23
23
  "repository": "postcss/autoprefixer",
24
24
  "peerDependencies": {
25
- "postcss": "^8.0.2"
25
+ "postcss": "^8.1.0"
26
26
  },
27
27
  "dependencies": {
28
- "browserslist": "^4.14.2",
29
- "caniuse-lite": "^1.0.30001131",
28
+ "browserslist": "^4.14.5",
29
+ "caniuse-lite": "^1.0.30001137",
30
30
  "colorette": "^1.2.1",
31
31
  "normalize-range": "^0.1.2",
32
32
  "num2fraction": "^1.2.2",