autoprefixer 10.0.3 → 10.2.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 +14 -0
- package/lib/autoprefixer.d.ts +95 -0
- package/lib/hacks/grid-utils.js +9 -1
- package/lib/resolution.js +13 -5
- package/lib/transition.js +23 -10
- package/package.json +5 -4
- package/tsconfig.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 10.2.1
|
|
5
|
+
* Fixed `transition-property` warnings (by @Sheraff).
|
|
6
|
+
|
|
7
|
+
## 10.2 “Sub rosa”
|
|
8
|
+
* Added TypeScript definitions (by Dmitry Semigradsky).
|
|
9
|
+
* Fixed docs (by Florian Pellet).
|
|
10
|
+
|
|
11
|
+
## 10.1 “Pula”
|
|
12
|
+
* Added `dpcm` unit support to `min-resolution: 2dppx` (by Robert Eisele).
|
|
13
|
+
* Fixed rational approximation in `min-resolution` (by Robert Eisele).
|
|
14
|
+
|
|
15
|
+
## 10.0.4
|
|
16
|
+
* Fixed `Cannot read property 'proxyOf' of undefined` error (by Igor Kamyshev).
|
|
17
|
+
|
|
4
18
|
## 10.0.3
|
|
5
19
|
* Fixed `substract` to `subtract` value for `mask-composite` (by Michelle Enos).
|
|
6
20
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Plugin } from 'postcss'
|
|
2
|
+
import { Stats } from 'browserslist'
|
|
3
|
+
|
|
4
|
+
declare function autoprefixer<T extends string[]> (
|
|
5
|
+
...args: [...T, autoprefixer.Options]
|
|
6
|
+
): Plugin & autoprefixer.ExportedAPI
|
|
7
|
+
|
|
8
|
+
declare function autoprefixer (
|
|
9
|
+
browsers: string[],
|
|
10
|
+
options?: autoprefixer.Options
|
|
11
|
+
): Plugin & autoprefixer.ExportedAPI
|
|
12
|
+
|
|
13
|
+
declare function autoprefixer (
|
|
14
|
+
options?: autoprefixer.Options
|
|
15
|
+
): Plugin & autoprefixer.ExportedAPI
|
|
16
|
+
|
|
17
|
+
declare namespace autoprefixer {
|
|
18
|
+
type GridValue = 'autoplace' | 'no-autoplace'
|
|
19
|
+
|
|
20
|
+
interface Options {
|
|
21
|
+
/** environment for `Browserslist` */
|
|
22
|
+
env?: string
|
|
23
|
+
|
|
24
|
+
/** should Autoprefixer use Visual Cascade, if CSS is uncompressed */
|
|
25
|
+
cascade?: boolean
|
|
26
|
+
|
|
27
|
+
/** should Autoprefixer add prefixes. */
|
|
28
|
+
add?: boolean
|
|
29
|
+
|
|
30
|
+
/** should Autoprefixer [remove outdated] prefixes */
|
|
31
|
+
remove?: boolean
|
|
32
|
+
|
|
33
|
+
/** should Autoprefixer add prefixes for @supports parameters. */
|
|
34
|
+
supports?: boolean
|
|
35
|
+
|
|
36
|
+
/** should Autoprefixer add prefixes for flexbox properties */
|
|
37
|
+
flexbox?: boolean | 'no-2009'
|
|
38
|
+
|
|
39
|
+
/** should Autoprefixer add IE 10-11 prefixes for Grid Layout properties */
|
|
40
|
+
grid?: boolean | GridValue
|
|
41
|
+
|
|
42
|
+
/** custom usage statistics for > 10% in my stats browsers query */
|
|
43
|
+
stats?: Stats
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* list of queries for target browsers.
|
|
47
|
+
* Try to not use it.
|
|
48
|
+
* The best practice is to use `.browserslistrc` config or `browserslist` key in `package.json`
|
|
49
|
+
* to share target browsers with Babel, ESLint and Stylelint
|
|
50
|
+
*/
|
|
51
|
+
overrideBrowserslist?: string | string[]
|
|
52
|
+
|
|
53
|
+
/** do not raise error on unknown browser version in `Browserslist` config. */
|
|
54
|
+
ignoreUnknownVersions?: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ExportedAPI {
|
|
58
|
+
/** Autoprefixer data */
|
|
59
|
+
data: {
|
|
60
|
+
browsers: { [browser: string]: object | undefined }
|
|
61
|
+
prefixes: { [prefixName: string]: object | undefined }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Autoprefixer default browsers */
|
|
65
|
+
defaults: string[]
|
|
66
|
+
|
|
67
|
+
/** Inspect with default Autoprefixer */
|
|
68
|
+
info(options?: { from?: string }): string
|
|
69
|
+
|
|
70
|
+
options: Options
|
|
71
|
+
|
|
72
|
+
browsers: string | string[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Autoprefixer data */
|
|
76
|
+
let data: ExportedAPI['data']
|
|
77
|
+
|
|
78
|
+
/** Autoprefixer default browsers */
|
|
79
|
+
let defaults: ExportedAPI['defaults']
|
|
80
|
+
|
|
81
|
+
/** Inspect with default Autoprefixer */
|
|
82
|
+
let info: ExportedAPI['info']
|
|
83
|
+
|
|
84
|
+
let postcss: true
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare global {
|
|
88
|
+
namespace NodeJS {
|
|
89
|
+
interface ProcessEnv {
|
|
90
|
+
AUTOPREFIXER_GRID?: autoprefixer.GridValue
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export = autoprefixer
|
package/lib/hacks/grid-utils.js
CHANGED
|
@@ -511,7 +511,15 @@ function insertAreas (css, isDisabled) {
|
|
|
511
511
|
|
|
512
512
|
// if we can't find the area name, update lastRule and continue
|
|
513
513
|
if (!area) {
|
|
514
|
-
let
|
|
514
|
+
let lastRule = rulesToInsert[lastArea].lastRule
|
|
515
|
+
let lastRuleIndex
|
|
516
|
+
if (lastRule) {
|
|
517
|
+
lastRuleIndex = css.index(lastRule)
|
|
518
|
+
} else {
|
|
519
|
+
/* istanbul ignore next */
|
|
520
|
+
lastRuleIndex = -1
|
|
521
|
+
}
|
|
522
|
+
|
|
515
523
|
if (gridAreaRuleIndex > lastRuleIndex) {
|
|
516
524
|
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule
|
|
517
525
|
}
|
package/lib/resolution.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
let
|
|
1
|
+
let Fraction = require('fraction.js')
|
|
2
2
|
|
|
3
3
|
let Prefixer = require('./prefixer')
|
|
4
4
|
let utils = require('./utils')
|
|
5
5
|
|
|
6
|
-
const REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpi|x)/gi
|
|
7
|
-
const SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpi|x)/i
|
|
6
|
+
const REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpcm|dpi|x)/gi
|
|
7
|
+
const SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpcm|dpi|x)/i
|
|
8
8
|
|
|
9
9
|
class Resolution extends Prefixer {
|
|
10
10
|
/**
|
|
@@ -22,11 +22,19 @@ class Resolution extends Prefixer {
|
|
|
22
22
|
* Return prefixed query
|
|
23
23
|
*/
|
|
24
24
|
prefixQuery (prefix, name, colon, value, units) {
|
|
25
|
+
value = new Fraction(value)
|
|
26
|
+
|
|
27
|
+
// 1dpcm = 2.54dpi
|
|
28
|
+
// 1dppx = 96dpi
|
|
25
29
|
if (units === 'dpi') {
|
|
26
|
-
value =
|
|
30
|
+
value = value.div(96)
|
|
31
|
+
} else if (units === 'dpcm') {
|
|
32
|
+
value = value.mul(2.54).div(96)
|
|
27
33
|
}
|
|
34
|
+
value = value.simplify()
|
|
35
|
+
|
|
28
36
|
if (prefix === '-o-') {
|
|
29
|
-
value =
|
|
37
|
+
value = value.n + '/' + value.d
|
|
30
38
|
}
|
|
31
39
|
return this.prefixName(prefix, name) + colon + value
|
|
32
40
|
}
|
package/lib/transition.js
CHANGED
|
@@ -118,6 +118,9 @@ class Transition {
|
|
|
118
118
|
return
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
let isPrefixed = false
|
|
122
|
+
let hasAssociatedProp = false
|
|
123
|
+
|
|
121
124
|
decl.parent.each(i => {
|
|
122
125
|
if (i.type !== 'decl') {
|
|
123
126
|
return undefined
|
|
@@ -125,21 +128,31 @@ class Transition {
|
|
|
125
128
|
if (i.prop.indexOf('transition-') !== 0) {
|
|
126
129
|
return undefined
|
|
127
130
|
}
|
|
131
|
+
let values = list.comma(i.value)
|
|
132
|
+
// check if current Rule's transition-property comma separated value list needs prefixes
|
|
128
133
|
if (i.prop === 'transition-property') {
|
|
134
|
+
values.forEach(value => {
|
|
135
|
+
let lookup = this.prefixes.add[value]
|
|
136
|
+
if (lookup && lookup.prefixes && lookup.prefixes.length > 0) {
|
|
137
|
+
isPrefixed = true
|
|
138
|
+
}
|
|
139
|
+
})
|
|
129
140
|
return undefined
|
|
130
141
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
decl.warn(
|
|
134
|
-
result,
|
|
135
|
-
'Replace transition-property to transition, ' +
|
|
136
|
-
'because Autoprefixer could not support ' +
|
|
137
|
-
'any cases of transition-property ' +
|
|
138
|
-
'and other transition-*'
|
|
139
|
-
)
|
|
140
|
-
}
|
|
142
|
+
// check if another transition-* prop in current Rule has comma separated value list
|
|
143
|
+
hasAssociatedProp = hasAssociatedProp || values.length > 1
|
|
141
144
|
return false
|
|
142
145
|
})
|
|
146
|
+
|
|
147
|
+
if (isPrefixed && hasAssociatedProp) {
|
|
148
|
+
decl.warn(
|
|
149
|
+
result,
|
|
150
|
+
'Replace transition-property to transition, ' +
|
|
151
|
+
'because Autoprefixer could not support ' +
|
|
152
|
+
'any cases of transition-property ' +
|
|
153
|
+
'and other transition-*'
|
|
154
|
+
)
|
|
155
|
+
}
|
|
143
156
|
}
|
|
144
157
|
|
|
145
158
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.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"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"main": "lib/autoprefixer.js",
|
|
16
16
|
"bin": "bin/autoprefixer",
|
|
17
|
+
"types": "lib/autoprefixer.d.ts",
|
|
17
18
|
"funding": {
|
|
18
19
|
"type": "opencollective",
|
|
19
20
|
"url": "https://opencollective.com/postcss/"
|
|
@@ -25,11 +26,11 @@
|
|
|
25
26
|
"postcss": "^8.1.0"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"browserslist": "^4.
|
|
29
|
-
"caniuse-lite": "^1.0.
|
|
29
|
+
"browserslist": "^4.16.1",
|
|
30
|
+
"caniuse-lite": "^1.0.30001173",
|
|
30
31
|
"colorette": "^1.2.1",
|
|
32
|
+
"fraction.js": "^4.0.13",
|
|
31
33
|
"normalize-range": "^0.1.2",
|
|
32
|
-
"num2fraction": "^1.2.2",
|
|
33
34
|
"postcss-value-parser": "^4.1.0"
|
|
34
35
|
},
|
|
35
36
|
"browser": {
|