postcss-merge-rules 8.0.1 → 8.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/LICENSE-MIT +1 -1
- package/README.md +1 -1
- package/package.json +30 -11
- package/src/index.js +61 -53
- package/src/lib/computeBrowsersToSupport.js +27 -0
- package/src/lib/ensureCompatibility.js +6 -5
- package/src/lib/getBrowsersForWebBuild.js +35 -0
- package/types/index.d.ts +9 -26
- package/types/index.d.ts.map +1 -1
- package/types/lib/computeBrowsersToSupport.d.ts +18 -0
- package/types/lib/computeBrowsersToSupport.d.ts.map +1 -0
- package/types/lib/ensureCompatibility.d.ts +62 -56
- package/types/lib/ensureCompatibility.d.ts.map +1 -1
- package/types/lib/getBrowsersForWebBuild.d.ts +3 -0
- package/types/lib/getBrowsersForWebBuild.d.ts.map +1 -0
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-merge-rules",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Merge CSS rules with PostCSS.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
|
+
"default": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./src": "./src/index.js",
|
|
11
|
+
"./src/index": "./src/index.js",
|
|
12
|
+
"./src/index.js": "./src/index.js",
|
|
13
|
+
"./src/lib/ensureCompatibility.js": "./src/lib/ensureCompatibility.js",
|
|
14
|
+
"./src/lib/ensureCompatibility": "./src/lib/ensureCompatibility.js",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"imports": {
|
|
18
|
+
"#getBrowsersList": {
|
|
19
|
+
"node": "./src/lib/computeBrowsersToSupport.js",
|
|
20
|
+
"default": "./src/lib/getBrowsersForWebBuild.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
7
23
|
"files": [
|
|
8
24
|
"LICENSE-MIT",
|
|
9
25
|
"src",
|
|
@@ -20,14 +36,17 @@
|
|
|
20
36
|
"author": {
|
|
21
37
|
"name": "Ben Briggs",
|
|
22
38
|
"email": "beneb.info@gmail.com",
|
|
23
|
-
"url": "
|
|
39
|
+
"url": "https://beneb.info"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "cssnano/cssnano"
|
|
24
44
|
},
|
|
25
|
-
"repository": "cssnano/cssnano",
|
|
26
45
|
"dependencies": {
|
|
27
|
-
"browserslist": "^4.28.
|
|
46
|
+
"browserslist": "^4.28.7",
|
|
28
47
|
"caniuse-api": "^4.0.0",
|
|
29
|
-
"postcss-selector-parser": "^7.1.
|
|
30
|
-
"cssnano-utils": "^6.0.
|
|
48
|
+
"postcss-selector-parser": "^7.1.4",
|
|
49
|
+
"cssnano-utils": "^6.0.2"
|
|
31
50
|
},
|
|
32
51
|
"bugs": {
|
|
33
52
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
@@ -36,11 +55,11 @@
|
|
|
36
55
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
37
56
|
},
|
|
38
57
|
"devDependencies": {
|
|
39
|
-
"postcss": "^8.5.
|
|
58
|
+
"postcss": "^8.5.25",
|
|
40
59
|
"postcss-simple-vars": "^7.0.1",
|
|
41
|
-
"postcss-discard-comments": "^8.0.
|
|
60
|
+
"postcss-discard-comments": "^8.0.2"
|
|
42
61
|
},
|
|
43
62
|
"peerDependencies": {
|
|
44
|
-
"postcss": "^8.5.
|
|
63
|
+
"postcss": "^8.5.25"
|
|
45
64
|
}
|
|
46
65
|
}
|
package/src/index.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
|
|
3
|
+
const getBrowsersList = require('#getBrowsersList');
|
|
4
|
+
|
|
5
|
+
/** @import browserslist from 'browserslist' */
|
|
6
|
+
|
|
4
7
|
const { sameParent } = require('cssnano-utils');
|
|
5
8
|
const {
|
|
6
9
|
ensureCompatibility,
|
|
7
10
|
sameVendor,
|
|
8
11
|
noVendor,
|
|
9
12
|
} = require('./lib/ensureCompatibility');
|
|
10
|
-
|
|
13
|
+
/** @import {Declaration, Rule} from 'postcss' */
|
|
11
14
|
/**
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
15
|
+
* @param {Declaration} a
|
|
16
|
+
* @param {Declaration} b
|
|
14
17
|
* @return {boolean}
|
|
15
18
|
*/
|
|
16
19
|
function declarationIsEqual(a, b) {
|
|
@@ -20,8 +23,8 @@ function declarationIsEqual(a, b) {
|
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
26
|
+
* @param {Declaration[]} array
|
|
27
|
+
* @param {Declaration} decl
|
|
25
28
|
* @return {number}
|
|
26
29
|
*/
|
|
27
30
|
function indexOfDeclaration(array, decl) {
|
|
@@ -30,10 +33,10 @@ function indexOfDeclaration(array, decl) {
|
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
35
|
* Returns filtered array of matched or unmatched declarations
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
36
|
+
* @param {Declaration[]} a
|
|
37
|
+
* @param {Declaration[]} b
|
|
35
38
|
* @param {boolean} [not=false]
|
|
36
|
-
* @return {
|
|
39
|
+
* @return {Declaration[]}
|
|
37
40
|
*/
|
|
38
41
|
function intersect(a, b, not) {
|
|
39
42
|
return a.filter((c) => {
|
|
@@ -43,8 +46,8 @@ function intersect(a, b, not) {
|
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {
|
|
49
|
+
* @param {Declaration[]} a
|
|
50
|
+
* @param {Declaration[]} b
|
|
48
51
|
* @return {boolean}
|
|
49
52
|
*/
|
|
50
53
|
function sameDeclarationsAndOrder(a, b) {
|
|
@@ -60,17 +63,17 @@ function sameDeclarationsAndOrder(a, b) {
|
|
|
60
63
|
*
|
|
61
64
|
* @typedef {Object} RuleMeta
|
|
62
65
|
* @property {string[]} selectors - Array of selector strings for the rule
|
|
63
|
-
* @property {
|
|
66
|
+
* @property {Declaration[]} declarations - Array of declaration nodes for the rule
|
|
64
67
|
* @property {boolean} dirty - Whether the selectors have been modified and need flushing
|
|
65
68
|
*/
|
|
66
69
|
|
|
67
70
|
/**
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {
|
|
71
|
+
* @param {Rule} ruleA
|
|
72
|
+
* @param {Rule} ruleB
|
|
70
73
|
* @param {string[]} browsers
|
|
71
74
|
* @param {Map<string, boolean>} compatibilityCache
|
|
72
|
-
* @param {WeakSet<
|
|
73
|
-
* @param {WeakMap<
|
|
75
|
+
* @param {WeakSet<Rule>} ruleCache
|
|
76
|
+
* @param {WeakMap<Rule, RuleMeta>} ruleMeta
|
|
74
77
|
* @return {boolean}
|
|
75
78
|
*/
|
|
76
79
|
function canMerge(
|
|
@@ -131,7 +134,7 @@ function isRuleOrAtRule(node) {
|
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
136
|
* @param {import('postcss').ChildNode} node
|
|
134
|
-
* @return {node is
|
|
137
|
+
* @return {node is Declaration}
|
|
135
138
|
*/
|
|
136
139
|
function isDeclaration(node) {
|
|
137
140
|
return node.type === 'decl';
|
|
@@ -143,8 +146,8 @@ function isDeclaration(node) {
|
|
|
143
146
|
* This metadata caches selectors and declarations to avoid expensive AST
|
|
144
147
|
* re-parsing, especially for the selectors.
|
|
145
148
|
*
|
|
146
|
-
* @param {
|
|
147
|
-
* @param {WeakMap<
|
|
149
|
+
* @param {Rule} rule The PostCSS rule to get metadata for.
|
|
150
|
+
* @param {WeakMap<Rule, RuleMeta>} [ruleMeta] The metadata cache.
|
|
148
151
|
* @return {RuleMeta} The rule's virtual metadata.
|
|
149
152
|
*/
|
|
150
153
|
function getMeta(rule, ruleMeta) {
|
|
@@ -170,8 +173,8 @@ function getMeta(rule, ruleMeta) {
|
|
|
170
173
|
/**
|
|
171
174
|
* Commits virtual metadata changes back to the actual PostCSS rule.
|
|
172
175
|
*
|
|
173
|
-
* @param {
|
|
174
|
-
* @param {WeakMap<
|
|
176
|
+
* @param {Rule} rule The PostCSS rule to flush.
|
|
177
|
+
* @param {WeakMap<Rule, RuleMeta>} ruleMeta The metadata cache.
|
|
175
178
|
*/
|
|
176
179
|
function flush(rule, ruleMeta) {
|
|
177
180
|
const meta = ruleMeta.get(rule);
|
|
@@ -182,15 +185,15 @@ function flush(rule, ruleMeta) {
|
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
/**
|
|
185
|
-
* @param {
|
|
186
|
-
* @return {
|
|
188
|
+
* @param {Rule} rule
|
|
189
|
+
* @return {Declaration[]}
|
|
187
190
|
*/
|
|
188
191
|
function getDecls(rule) {
|
|
189
192
|
return rule.nodes.filter(isDeclaration);
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
/**
|
|
193
|
-
* @param {...
|
|
196
|
+
* @param {...Rule} rules
|
|
194
197
|
* @return {number}
|
|
195
198
|
*/
|
|
196
199
|
function ruleLength(...rules) {
|
|
@@ -275,8 +278,8 @@ function isConflictingProp(propA, propB) {
|
|
|
275
278
|
}
|
|
276
279
|
|
|
277
280
|
/**
|
|
278
|
-
* @param {
|
|
279
|
-
* @param {
|
|
281
|
+
* @param {Rule} first
|
|
282
|
+
* @param {Rule} second
|
|
280
283
|
* @return {boolean} merged
|
|
281
284
|
*/
|
|
282
285
|
function mergeParents(first, second) {
|
|
@@ -298,13 +301,13 @@ function mergeParents(first, second) {
|
|
|
298
301
|
}
|
|
299
302
|
|
|
300
303
|
/**
|
|
301
|
-
* @param {
|
|
302
|
-
* @param {
|
|
304
|
+
* @param {Rule} first
|
|
305
|
+
* @param {Rule} second
|
|
303
306
|
* @param {string[]} browsers
|
|
304
307
|
* @param {Map<string, boolean>} compatibilityCache
|
|
305
|
-
* @param {WeakSet<
|
|
306
|
-
* @param {WeakMap<
|
|
307
|
-
* @return {
|
|
308
|
+
* @param {WeakSet<Rule>} ruleCache
|
|
309
|
+
* @param {WeakMap<Rule, RuleMeta>} ruleMeta
|
|
310
|
+
* @return {Rule} mergedRule
|
|
308
311
|
*/
|
|
309
312
|
function partialMerge(
|
|
310
313
|
first,
|
|
@@ -345,7 +348,7 @@ function partialMerge(
|
|
|
345
348
|
)
|
|
346
349
|
) {
|
|
347
350
|
const metaNext = getMeta(nextRule, ruleMeta);
|
|
348
|
-
|
|
351
|
+
const nextIntersection = intersect(
|
|
349
352
|
metaSecond.declarations,
|
|
350
353
|
metaNext.declarations
|
|
351
354
|
);
|
|
@@ -359,8 +362,8 @@ function partialMerge(
|
|
|
359
362
|
|
|
360
363
|
const metaFirstActual = getMeta(first, ruleMeta);
|
|
361
364
|
const metaSecondActual = getMeta(second, ruleMeta);
|
|
362
|
-
|
|
363
|
-
|
|
365
|
+
const firstDecls = [...metaFirstActual.declarations];
|
|
366
|
+
const secondDecls = [...metaSecondActual.declarations];
|
|
364
367
|
|
|
365
368
|
// Filter out intersections with later conflicts in First
|
|
366
369
|
intersection = intersection.filter((decl, intersectIndex) => {
|
|
@@ -426,9 +429,9 @@ function partialMerge(
|
|
|
426
429
|
const secondClone = second.clone({ selectors: secondSelectors });
|
|
427
430
|
|
|
428
431
|
/**
|
|
429
|
-
* @param {
|
|
432
|
+
* @param {(decl: Declaration) => void} callback
|
|
430
433
|
* @this void
|
|
431
|
-
* @return {
|
|
434
|
+
* @return {(decl: Declaration) => void}
|
|
432
435
|
*/
|
|
433
436
|
function moveDecl(callback) {
|
|
434
437
|
return (decl) => {
|
|
@@ -438,10 +441,15 @@ function partialMerge(
|
|
|
438
441
|
};
|
|
439
442
|
}
|
|
440
443
|
firstClone.walkDecls(
|
|
441
|
-
moveDecl(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
444
|
+
moveDecl(
|
|
445
|
+
/**
|
|
446
|
+
* @param {Declaration} decl
|
|
447
|
+
*/
|
|
448
|
+
(decl) => {
|
|
449
|
+
decl.remove();
|
|
450
|
+
receivingBlock.append(decl);
|
|
451
|
+
}
|
|
452
|
+
)
|
|
445
453
|
);
|
|
446
454
|
secondClone.walkDecls(moveDecl((decl) => decl.remove()));
|
|
447
455
|
|
|
@@ -479,12 +487,12 @@ function partialMerge(
|
|
|
479
487
|
/**
|
|
480
488
|
* @param {string[]} browsers
|
|
481
489
|
* @param {Map<string, boolean>} compatibilityCache
|
|
482
|
-
* @param {WeakSet<
|
|
483
|
-
* @param {WeakMap<
|
|
484
|
-
* @return {{ merger:
|
|
490
|
+
* @param {WeakSet<Rule>} ruleCache
|
|
491
|
+
* @param {WeakMap<Rule, RuleMeta>} ruleMeta
|
|
492
|
+
* @return {{ merger: (rule: Rule) => void, clean: () => void }}
|
|
485
493
|
*/
|
|
486
494
|
function selectorMerger(browsers, compatibilityCache, ruleCache, ruleMeta) {
|
|
487
|
-
/** @type {
|
|
495
|
+
/** @type {Rule | null} */
|
|
488
496
|
let cache = null;
|
|
489
497
|
return {
|
|
490
498
|
merger(rule) {
|
|
@@ -550,7 +558,7 @@ function selectorMerger(browsers, compatibilityCache, ruleCache, ruleMeta) {
|
|
|
550
558
|
node.remove();
|
|
551
559
|
return;
|
|
552
560
|
}
|
|
553
|
-
/** @type {
|
|
561
|
+
/** @type {Rule} */ (cache).append(node);
|
|
554
562
|
});
|
|
555
563
|
getMeta(cache, ruleMeta).declarations = getDecls(cache);
|
|
556
564
|
rule.remove();
|
|
@@ -584,7 +592,6 @@ function selectorMerger(browsers, compatibilityCache, ruleCache, ruleMeta) {
|
|
|
584
592
|
*/
|
|
585
593
|
|
|
586
594
|
/**
|
|
587
|
-
* @type {import('postcss').PluginCreator<Options>}
|
|
588
595
|
* @param {Options} opts
|
|
589
596
|
* @return {import('postcss').Plugin}
|
|
590
597
|
*/
|
|
@@ -597,11 +604,7 @@ function pluginCreator(opts = {}) {
|
|
|
597
604
|
*/
|
|
598
605
|
prepare(result) {
|
|
599
606
|
const { stats, env, from, file } = result.opts || {};
|
|
600
|
-
const browsers =
|
|
601
|
-
stats: opts.stats || stats,
|
|
602
|
-
path: opts.path || dirname(from || file || __filename),
|
|
603
|
-
env: opts.env || env,
|
|
604
|
-
});
|
|
607
|
+
const browsers = getBrowsersList(opts, stats, from, file, env);
|
|
605
608
|
|
|
606
609
|
const compatibilityCache = new Map();
|
|
607
610
|
|
|
@@ -610,6 +613,9 @@ function pluginCreator(opts = {}) {
|
|
|
610
613
|
const ruleMeta = new WeakMap();
|
|
611
614
|
|
|
612
615
|
return {
|
|
616
|
+
/**
|
|
617
|
+
* @param {import('postcss').Root} css
|
|
618
|
+
*/
|
|
613
619
|
OnceExit(css) {
|
|
614
620
|
const { merger, clean } = selectorMerger(
|
|
615
621
|
browsers,
|
|
@@ -626,4 +632,6 @@ function pluginCreator(opts = {}) {
|
|
|
626
632
|
}
|
|
627
633
|
|
|
628
634
|
pluginCreator.postcss = true;
|
|
629
|
-
module.exports =
|
|
635
|
+
module.exports = /** @type {import('postcss').PluginCreator<Options>} */ (
|
|
636
|
+
pluginCreator
|
|
637
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const browserslist = require('browserslist');
|
|
4
|
+
const { dirname } = require('node:path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {{overrideBrowserslist?: string | string[] | undefined, stats?: browserslist.Options["stats"], path?: browserslist.Options["path"], env?: browserslist.Options["env"]}} options
|
|
9
|
+
* @param {browserslist.Options["stats"]} stats
|
|
10
|
+
* @param {string|undefined} from
|
|
11
|
+
* @param {string} [file]
|
|
12
|
+
* @param {browserslist.Options["env"]} [env]
|
|
13
|
+
* @returns {string[]}
|
|
14
|
+
*/
|
|
15
|
+
module.exports = function computeBrowsersToSupport(
|
|
16
|
+
options,
|
|
17
|
+
stats,
|
|
18
|
+
from,
|
|
19
|
+
file,
|
|
20
|
+
env
|
|
21
|
+
) {
|
|
22
|
+
return browserslist(options.overrideBrowserslist, {
|
|
23
|
+
stats: options.stats || stats,
|
|
24
|
+
path: options.path || dirname(from || file || __filename),
|
|
25
|
+
env: options.env || env,
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -26,14 +26,15 @@ function filterPrefixes(selector) {
|
|
|
26
26
|
return selector.match(vendorPrefix);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
const inputPlaceholderRegex = /-ms-input-placeholder/i;
|
|
29
30
|
/**
|
|
30
31
|
* Internet Explorer use :-ms-input-placeholder.
|
|
31
32
|
* Microsoft Edge use ::-ms-input-placeholder.
|
|
32
33
|
*
|
|
33
|
-
* @type {(selector: string) =>
|
|
34
|
+
* @type {(selector: string) => boolean}
|
|
34
35
|
*/
|
|
35
36
|
const findMsInputPlaceholder = (selector) =>
|
|
36
|
-
|
|
37
|
+
inputPlaceholderRegex.test(selector);
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* @param {string[]} selectorsA
|
|
@@ -42,9 +43,9 @@ const findMsInputPlaceholder = (selector) =>
|
|
|
42
43
|
*/
|
|
43
44
|
function sameVendor(selectorsA, selectorsB) {
|
|
44
45
|
/** @type {(selectors: string[]) => string} */
|
|
45
|
-
|
|
46
|
+
const same = (selectors) => selectors.map(filterPrefixes).join();
|
|
46
47
|
/** @type {(selectors: string[]) => string | undefined} */
|
|
47
|
-
|
|
48
|
+
const findMsVendor = (selectors) => selectors.find(findMsInputPlaceholder);
|
|
48
49
|
return (
|
|
49
50
|
same(selectorsA) === same(selectorsB) &&
|
|
50
51
|
!(findMsVendor(selectorsA) && findMsVendor(selectorsB))
|
|
@@ -177,7 +178,7 @@ function ensureCompatibility(selectors, browsers, compatibilityCache) {
|
|
|
177
178
|
const { type, value } = node;
|
|
178
179
|
if (type === 'pseudo') {
|
|
179
180
|
const entry =
|
|
180
|
-
pseudoElements[/** @type
|
|
181
|
+
pseudoElements[/** @type keyof typeof pseudoElements*/ (value)];
|
|
181
182
|
if (!entry && noVendor(value)) {
|
|
182
183
|
compatible = false;
|
|
183
184
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function () {
|
|
4
|
+
return [
|
|
5
|
+
'and_chr 150',
|
|
6
|
+
'and_ff 152',
|
|
7
|
+
'and_qq 14.9',
|
|
8
|
+
'and_uc 15.5',
|
|
9
|
+
'android 150',
|
|
10
|
+
'chrome 150',
|
|
11
|
+
'chrome 149',
|
|
12
|
+
'chrome 148',
|
|
13
|
+
'chrome 118',
|
|
14
|
+
'chrome 109',
|
|
15
|
+
'edge 150',
|
|
16
|
+
'edge 149',
|
|
17
|
+
'edge 148',
|
|
18
|
+
'firefox 152',
|
|
19
|
+
'firefox 151',
|
|
20
|
+
'firefox 140',
|
|
21
|
+
'ios_saf 26.5',
|
|
22
|
+
'ios_saf 26.4',
|
|
23
|
+
'ios_saf 26.3',
|
|
24
|
+
'ios_saf 18.5-18.7',
|
|
25
|
+
'kaios 3.0-3.1',
|
|
26
|
+
'op_mob 80',
|
|
27
|
+
'opera 131',
|
|
28
|
+
'opera 127',
|
|
29
|
+
'safari 26.5',
|
|
30
|
+
'safari 26.4',
|
|
31
|
+
'safari 26.3',
|
|
32
|
+
'samsung 30',
|
|
33
|
+
'samsung 29',
|
|
34
|
+
];
|
|
35
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @type {import('postcss').PluginCreator<Options>}
|
|
9
|
-
* @param {Options} opts
|
|
10
|
-
* @return {import('postcss').Plugin}
|
|
11
|
-
*/
|
|
12
|
-
declare function pluginCreator(opts?: Options): import("postcss").Plugin;
|
|
13
|
-
declare namespace pluginCreator {
|
|
14
|
-
export { postcss, RuleMeta, AutoprefixerOptions, BrowserslistOptions, Options };
|
|
15
|
-
}
|
|
16
|
-
declare var postcss: true;
|
|
17
|
-
/**
|
|
18
|
-
* RuleMeta stores metadata about a `Rule` during the merging process.
|
|
19
|
-
* It tracks selectors and declarations without re-parsing the AST many times.
|
|
20
|
-
*/
|
|
21
|
-
type RuleMeta = {
|
|
1
|
+
declare const _exports: import("postcss").PluginCreator<Options>;
|
|
2
|
+
export = _exports;
|
|
3
|
+
import type browserslist from 'browserslist';
|
|
4
|
+
import type { Declaration } from 'postcss';
|
|
5
|
+
export type RuleMeta = {
|
|
22
6
|
/**
|
|
23
7
|
* - Array of selector strings for the rule
|
|
24
8
|
*/
|
|
@@ -26,16 +10,15 @@ type RuleMeta = {
|
|
|
26
10
|
/**
|
|
27
11
|
* - Array of declaration nodes for the rule
|
|
28
12
|
*/
|
|
29
|
-
declarations:
|
|
13
|
+
declarations: Declaration[];
|
|
30
14
|
/**
|
|
31
15
|
* - Whether the selectors have been modified and need flushing
|
|
32
16
|
*/
|
|
33
17
|
dirty: boolean;
|
|
34
18
|
};
|
|
35
|
-
type AutoprefixerOptions = {
|
|
19
|
+
export type AutoprefixerOptions = {
|
|
36
20
|
overrideBrowserslist?: string | string[];
|
|
37
21
|
};
|
|
38
|
-
type BrowserslistOptions = Pick<browserslist.Options,
|
|
39
|
-
type Options = AutoprefixerOptions & BrowserslistOptions;
|
|
40
|
-
import browserslist = require("browserslist");
|
|
22
|
+
export type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>;
|
|
23
|
+
export type Options = AutoprefixerOptions & BrowserslistOptions;
|
|
41
24
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;AAII,OAAQ,KAAA,YAAY,MAAM,cAAc,CAAA;AAQxC,OAAQ,KAAA,EAAC,WAAW,EAAO,MAAM,SAAS,CAAA;AAmD3C,YAAkB,QAAQ,GAC1B;;;;IAAqB,SAAS,EAAnB,MAAM,EAAE,CACnB;;;;IAA0B,YAAY,EAA3B,WAAW,EAAE,CACxB;;;;IAAoB,KAAK,EAAd,OAAO,CACpB;CAAA,CAAA;AAygBE,YAAwD,mBAAmB,GAAjE;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,CAAqB;AAC3E,YAAgE,mBAAmB,GAAzE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,CAAqB;AACnF,YAAqD,OAAO,GAAlD,mBAAmB,GAAG,mBAAmB,CAAS"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export = computeBrowsersToSupport;
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {{overrideBrowserslist?: string | string[] | undefined, stats?: browserslist.Options["stats"], path?: browserslist.Options["path"], env?: browserslist.Options["env"]}} options
|
|
5
|
+
* @param {browserslist.Options["stats"]} stats
|
|
6
|
+
* @param {string|undefined} from
|
|
7
|
+
* @param {string} [file]
|
|
8
|
+
* @param {browserslist.Options["env"]} [env]
|
|
9
|
+
* @returns {string[]}
|
|
10
|
+
*/
|
|
11
|
+
declare function computeBrowsersToSupport(options: {
|
|
12
|
+
overrideBrowserslist?: string | string[] | undefined;
|
|
13
|
+
stats?: browserslist.Options["stats"];
|
|
14
|
+
path?: browserslist.Options["path"];
|
|
15
|
+
env?: browserslist.Options["env"];
|
|
16
|
+
}, stats: browserslist.Options["stats"], from: string | undefined, file?: string, env?: browserslist.Options["env"]): string[];
|
|
17
|
+
import browserslist = require('browserslist');
|
|
18
|
+
//# sourceMappingURL=computeBrowsersToSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeBrowsersToSupport.d.ts","sourceRoot":"","sources":["../../src/lib/computeBrowsersToSupport.js"],"names":[],"mappings":";AAKA;;;;;;;;GAQG;0CAED,OAAO,EARE;IAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAAC,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;CAQtK,EACP,KAAK,EARI,YAAY,CAAC,OAAO,CAAC,OAAO,CAQhC,EACL,IAAI,EARK,MAAM,GAAC,SAQZ,EACJ,IAAI,AARH,CACA,EADQ,MAQL,EACJ,GAAG,AARF,CACA,EADQ,YAAY,CAAC,OAAO,CAAC,KAAK,CAQhC,GAPQ,MAAM,EAAE;OAVf,YAAY,WAAW,cAAc"}
|
|
@@ -1,72 +1,78 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
sameVendor: typeof sameVendor;
|
|
3
|
+
noVendor: typeof noVendor;
|
|
4
|
+
pseudoElements: {
|
|
5
|
+
':active': string;
|
|
6
|
+
':after': string;
|
|
7
|
+
':any-link': string;
|
|
8
|
+
':before': string;
|
|
9
|
+
':checked': string;
|
|
10
|
+
':default': string;
|
|
11
|
+
':dir': string;
|
|
12
|
+
':disabled': string;
|
|
13
|
+
':empty': string;
|
|
14
|
+
':enabled': string;
|
|
15
|
+
':first-child': string;
|
|
16
|
+
':first-letter': string;
|
|
17
|
+
':first-line': string;
|
|
18
|
+
':first-of-type': string;
|
|
19
|
+
':focus': string;
|
|
20
|
+
':focus-within': string;
|
|
21
|
+
':focus-visible': string;
|
|
22
|
+
':has': string;
|
|
23
|
+
':hover': string;
|
|
24
|
+
':in-range': string;
|
|
25
|
+
':indeterminate': string;
|
|
26
|
+
':invalid': string;
|
|
27
|
+
':is': string;
|
|
28
|
+
':lang': string;
|
|
29
|
+
':last-child': string;
|
|
30
|
+
':last-of-type': string;
|
|
31
|
+
':link': string;
|
|
32
|
+
':matches': string;
|
|
33
|
+
':not': string;
|
|
34
|
+
':nth-child': string;
|
|
35
|
+
':nth-last-child': string;
|
|
36
|
+
':nth-last-of-type': string;
|
|
37
|
+
':nth-of-type': string;
|
|
38
|
+
':only-child': string;
|
|
39
|
+
':only-of-type': string;
|
|
40
|
+
':optional': string;
|
|
41
|
+
':out-of-range': string;
|
|
42
|
+
':placeholder-shown': string;
|
|
43
|
+
':required': string;
|
|
44
|
+
':root': string;
|
|
45
|
+
':target': string;
|
|
46
|
+
'::after': string;
|
|
47
|
+
'::backdrop': string;
|
|
48
|
+
'::before': string;
|
|
49
|
+
'::first-letter': string;
|
|
50
|
+
'::first-line': string;
|
|
51
|
+
'::marker': string;
|
|
52
|
+
'::placeholder': string;
|
|
53
|
+
'::selection': string;
|
|
54
|
+
':valid': string;
|
|
55
|
+
':visited': string;
|
|
56
|
+
};
|
|
57
|
+
ensureCompatibility: typeof ensureCompatibility;
|
|
58
|
+
};
|
|
59
|
+
export = _exports;
|
|
1
60
|
/**
|
|
2
61
|
* @param {string[]} selectorsA
|
|
3
62
|
* @param {string[]} selectorsB
|
|
4
63
|
* @return {boolean}
|
|
5
64
|
*/
|
|
6
|
-
|
|
65
|
+
declare function sameVendor(selectorsA: string[], selectorsB: string[]): boolean;
|
|
7
66
|
/**
|
|
8
67
|
* @param {string} selector
|
|
9
68
|
* @return {boolean}
|
|
10
69
|
*/
|
|
11
|
-
|
|
12
|
-
export const pseudoElements: {
|
|
13
|
-
':active': string;
|
|
14
|
-
':after': string;
|
|
15
|
-
':any-link': string;
|
|
16
|
-
':before': string;
|
|
17
|
-
':checked': string;
|
|
18
|
-
':default': string;
|
|
19
|
-
':dir': string;
|
|
20
|
-
':disabled': string;
|
|
21
|
-
':empty': string;
|
|
22
|
-
':enabled': string;
|
|
23
|
-
':first-child': string;
|
|
24
|
-
':first-letter': string;
|
|
25
|
-
':first-line': string;
|
|
26
|
-
':first-of-type': string;
|
|
27
|
-
':focus': string;
|
|
28
|
-
':focus-within': string;
|
|
29
|
-
':focus-visible': string;
|
|
30
|
-
':has': string;
|
|
31
|
-
':hover': string;
|
|
32
|
-
':in-range': string;
|
|
33
|
-
':indeterminate': string;
|
|
34
|
-
':invalid': string;
|
|
35
|
-
':is': string;
|
|
36
|
-
':lang': string;
|
|
37
|
-
':last-child': string;
|
|
38
|
-
':last-of-type': string;
|
|
39
|
-
':link': string;
|
|
40
|
-
':matches': string;
|
|
41
|
-
':not': string;
|
|
42
|
-
':nth-child': string;
|
|
43
|
-
':nth-last-child': string;
|
|
44
|
-
':nth-last-of-type': string;
|
|
45
|
-
':nth-of-type': string;
|
|
46
|
-
':only-child': string;
|
|
47
|
-
':only-of-type': string;
|
|
48
|
-
':optional': string;
|
|
49
|
-
':out-of-range': string;
|
|
50
|
-
':placeholder-shown': string;
|
|
51
|
-
':required': string;
|
|
52
|
-
':root': string;
|
|
53
|
-
':target': string;
|
|
54
|
-
'::after': string;
|
|
55
|
-
'::backdrop': string;
|
|
56
|
-
'::before': string;
|
|
57
|
-
'::first-letter': string;
|
|
58
|
-
'::first-line': string;
|
|
59
|
-
'::marker': string;
|
|
60
|
-
'::placeholder': string;
|
|
61
|
-
'::selection': string;
|
|
62
|
-
':valid': string;
|
|
63
|
-
':visited': string;
|
|
64
|
-
};
|
|
70
|
+
declare function noVendor(selector: string): boolean;
|
|
65
71
|
/**
|
|
66
72
|
* @param {string[]} selectors
|
|
67
73
|
* @param{string[]=} browsers
|
|
68
74
|
* @param{Map<string,boolean>=} compatibilityCache
|
|
69
75
|
* @return {boolean}
|
|
70
76
|
*/
|
|
71
|
-
|
|
77
|
+
declare function ensureCompatibility(selectors: string[], browsers?: string[] | undefined, compatibilityCache?: Map<string, boolean> | undefined): boolean;
|
|
72
78
|
//# sourceMappingURL=ensureCompatibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureCompatibility.d.ts","sourceRoot":"","sources":["../../src/lib/ensureCompatibility.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensureCompatibility.d.ts","sourceRoot":"","sources":["../../src/lib/ensureCompatibility.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,UAAU,EAJnB,MAAM,EAIa,EAAE,UAAU,EAH/B,MAAM,EAGyB,GAF9B,OAAO,CAWlB;AAED;;;GAGG;AACH,iBAAS,QAAQ,CAAC,QAAQ,EAHf,MAGe,GAFd,OAAO,CAIlB;AA2FD;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,SAAS,EAL3B,MAAM,EAKqB,EAAE,QAAQ,AAJ7C,CACA,EADO,MAAM,EAAE,YAI8B,EAAE,kBAAkB,AAHjE,CACA,EADO,GAAG,CAAC,MAAM,EAAC,OAAO,CAAC,YAGuC,GAFxD,OAAO,CA0ElB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBrowsersForWebBuild.d.ts","sourceRoot":"","sources":["../../src/lib/getBrowsersForWebBuild.js"],"names":[],"mappings":""}
|