postcss-merge-rules 8.0.5 → 9.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/package.json +8 -13
- package/src/index.js +547 -518
- package/src/lib/computeBrowsersToSupport.js +10 -12
- package/src/lib/declarations.js +146 -0
- package/src/lib/ensureCompatibility.js +4 -4
- package/src/lib/getBrowsersForWebBuild.js +2 -4
- package/src/lib/propertyRelations.js +2 -5
- package/src/lib/rule-meta.js +58 -0
- package/src/lib/rule-rewrite.js +170 -0
- package/types/index.d.ts +15 -2
- package/types/index.d.ts.map +1 -1
- package/types/lib/computeBrowsersToSupport.d.ts +2 -2
- package/types/lib/computeBrowsersToSupport.d.ts.map +1 -1
- package/types/lib/declarations.d.ts +31 -0
- package/types/lib/declarations.d.ts.map +1 -0
- package/types/lib/ensureCompatibility.d.ts +54 -59
- package/types/lib/ensureCompatibility.d.ts.map +1 -1
- package/types/lib/getBrowsersForWebBuild.d.ts +2 -2
- package/types/lib/propertyRelations.d.ts +1 -4
- package/types/lib/propertyRelations.d.ts.map +1 -1
- package/types/lib/rule-meta.d.ts +21 -0
- package/types/lib/rule-meta.d.ts.map +1 -0
- package/types/lib/rule-rewrite.d.ts +40 -0
- package/types/lib/rule-rewrite.d.ts.map +1 -0
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
declare const _exports: {
|
|
2
|
-
isConflictingProp: typeof isConflictingProp;
|
|
3
|
-
};
|
|
4
|
-
export = _exports;
|
|
5
1
|
/**
|
|
6
2
|
* True if declarations of `propA` and `propB` can set the same underlying
|
|
7
3
|
* property, so that reordering them within a rule can change what the rule
|
|
@@ -14,4 +10,5 @@ export = _exports;
|
|
|
14
10
|
* @return {boolean}
|
|
15
11
|
*/
|
|
16
12
|
declare function isConflictingProp(propA: string, propB: string): boolean;
|
|
13
|
+
export { isConflictingProp };
|
|
17
14
|
//# sourceMappingURL=propertyRelations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyRelations.d.ts","sourceRoot":"","sources":["../../src/lib/propertyRelations.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propertyRelations.d.ts","sourceRoot":"","sources":["../../src/lib/propertyRelations.js"],"names":[],"mappings":"AAsHA;;;;;;;;;;GAUG;AACH,iBAAS,iBAAiB,CAAC,KAAK,EAJrB,MAIqB,EAAE,KAAK,EAH5B,MAG4B,GAF3B,OAAO,CAuClB;AACD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @import {Declaration, Rule} from 'postcss' */
|
|
2
|
+
import type { Declaration, Rule } from 'postcss';
|
|
3
|
+
export type RuleMeta = {
|
|
4
|
+
selectors: string[];
|
|
5
|
+
declarations: Declaration[];
|
|
6
|
+
dirty: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {Rule} rule
|
|
10
|
+
* @param {WeakMap<Rule, RuleMeta>} [ruleMeta]
|
|
11
|
+
* @return {RuleMeta}
|
|
12
|
+
*/
|
|
13
|
+
export declare function getMeta(rule: Rule, ruleMeta?: WeakMap<Rule, RuleMeta>): RuleMeta;
|
|
14
|
+
/**
|
|
15
|
+
* @param {Rule} rule
|
|
16
|
+
* @param {WeakMap<Rule, RuleMeta>} ruleMeta
|
|
17
|
+
*/
|
|
18
|
+
export declare function flush(rule: Rule, ruleMeta: WeakMap<Rule, RuleMeta>): void;
|
|
19
|
+
/** @param {Rule} rule @return {Declaration[]} */
|
|
20
|
+
export declare function getDecls(rule: Rule): Declaration[];
|
|
21
|
+
//# sourceMappingURL=rule-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-meta.d.ts","sourceRoot":"","sources":["../../src/lib/rule-meta.js"],"names":[],"mappings":"AAAA,iDAAiD;AAA7C,OAAQ,KAAA,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,SAAS,CAAA;AAG3C,YAAkB,QAAQ,GAC1B;IAAqB,SAAS,EAAnB,MAAM,EAAE,CACnB;IAA0B,YAAY,EAA3B,WAAW,EAAE,CACxB;IAAoB,KAAK,EAAd,OAAO,CACpB;CAAA,CAAA;AAUD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAJjB,IAIiB,EAAE,QAAQ,AAHnC,CACA,EADQ,OAAO,CAAC,IAAI,EAAE,QAAQ,CAGK,GAF1B,QAAQ,CAoBnB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAHf,IAGe,EAAE,QAAQ,EAFzB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAEG,QAMnC;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,CAAC,IAAI,EADjB,IACiB,GADG,WAAW,EAAE,CAG5C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Declaration, Rule } from 'postcss';
|
|
2
|
+
/** @import {Declaration, Rule} from 'postcss' */
|
|
3
|
+
/**
|
|
4
|
+
* @param {Rule} first
|
|
5
|
+
* @param {Rule} second
|
|
6
|
+
* @return {boolean}
|
|
7
|
+
*/
|
|
8
|
+
export declare function mergeParents(first: Rule, second: Rule): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @param {Rule} first
|
|
11
|
+
* @param {Rule} second
|
|
12
|
+
* @param {Declaration[]} intersection
|
|
13
|
+
* @param {string[]} browsers
|
|
14
|
+
* @param {Map<string, boolean>} compatibilityCache
|
|
15
|
+
* @param {WeakSet<Rule>} ruleCache
|
|
16
|
+
* @param {WeakMap<Rule, import('./rule-meta.js').RuleMeta>} ruleMeta
|
|
17
|
+
* @param {(a: Rule, b: Rule, browsers: string[], compatibilityCache: Map<string, boolean>, ruleCache: WeakSet<Rule>, ruleMeta: WeakMap<Rule, import('./rule-meta.js').RuleMeta>) => boolean} canMerge
|
|
18
|
+
* @param {(rule: Rule, oldParent: import('postcss').Container, newParent: import('postcss').Container) => void} [onMove]
|
|
19
|
+
* @return {{first: Rule, second: Rule, intersection: Declaration[], moved: boolean}}
|
|
20
|
+
*/
|
|
21
|
+
export declare function mergeWithNextRule(first: Rule, second: Rule, intersection: Declaration[], browsers: string[], compatibilityCache: Map<string, boolean>, ruleCache: WeakSet<Rule>, ruleMeta: WeakMap<Rule, import('./rule-meta.js').RuleMeta>, canMerge: (a: Rule, b: Rule, browsers: string[], compatibilityCache: Map<string, boolean>, ruleCache: WeakSet<Rule>, ruleMeta: WeakMap<Rule, import('./rule-meta.js').RuleMeta>) => boolean, onMove?: (rule: Rule, oldParent: import('postcss').Container, newParent: import('postcss').Container) => void): {
|
|
22
|
+
first: Rule;
|
|
23
|
+
second: Rule;
|
|
24
|
+
intersection: Declaration[];
|
|
25
|
+
moved: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @param {Rule} first
|
|
29
|
+
* @param {Rule} second
|
|
30
|
+
* @param {Declaration[]} intersection
|
|
31
|
+
* @param {Set<number>} claimedIndices
|
|
32
|
+
* @param {WeakSet<Rule>} ruleCache
|
|
33
|
+
* @param {WeakMap<Rule, import('./rule-meta.js').RuleMeta>} ruleMeta
|
|
34
|
+
* @return {{rule: Rule, replacements: Rule[]}}
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildMergedRule(first: Rule, second: Rule, intersection: Declaration[], claimedIndices: Set<number>, ruleCache: WeakSet<Rule>, ruleMeta: WeakMap<Rule, import('./rule-meta.js').RuleMeta>): {
|
|
37
|
+
rule: Rule;
|
|
38
|
+
replacements: Rule[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=rule-rewrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-rewrite.d.ts","sourceRoot":"","sources":["../../src/lib/rule-rewrite.js"],"names":[],"mappings":"AAGI,OAAQ,KAAA,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,SAAS,CAAA;AAA9C,iDAAiD;AAEjD;;;;GAIG;AACH,wBAAgB,YAAY,CAA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