stylehacks 8.0.2 → 8.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/package.json +8 -5
- package/src/index.js +6 -6
- package/src/plugin.js +6 -4
- package/src/plugins/leadingStar.js +4 -4
- package/types/plugin.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylehacks",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"description": "Detect/remove browser hacks from CSS files.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"url": "cssnano/cssnano"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"browserslist": "^4.28.
|
|
49
|
-
"postcss-selector-parser": "^7.1.
|
|
48
|
+
"browserslist": "^4.28.8",
|
|
49
|
+
"postcss-selector-parser": "^7.1.5"
|
|
50
50
|
},
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
@@ -55,9 +55,12 @@
|
|
|
55
55
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"postcss": "^8.5.
|
|
58
|
+
"postcss": "^8.5.26"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"postcss": "^8.5.
|
|
61
|
+
"postcss": "^8.5.26"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"test": "node --test"
|
|
62
65
|
}
|
|
63
66
|
}
|
package/src/index.js
CHANGED
|
@@ -38,17 +38,17 @@ function pluginCreator(opts = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
css.walk((node) => {
|
|
41
|
-
|
|
41
|
+
for (const proc of processors) {
|
|
42
42
|
if (!proc.nodeTypes.has(node.type)) {
|
|
43
|
-
|
|
43
|
+
continue;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (opts.lint) {
|
|
47
|
-
|
|
47
|
+
proc.detectAndWarn(node);
|
|
48
|
+
} else {
|
|
49
|
+
proc.detectAndResolve(node);
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
return proc.detectAndResolve(node);
|
|
51
|
-
});
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
54
|
};
|
package/src/plugin.js
CHANGED
|
@@ -92,17 +92,19 @@ module.exports = class BasePlugin {
|
|
|
92
92
|
|
|
93
93
|
/** @return {void} */
|
|
94
94
|
resolve() {
|
|
95
|
-
|
|
95
|
+
for (const node of this.nodes) {
|
|
96
|
+
node.remove();
|
|
97
|
+
}
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
warn() {
|
|
99
|
-
|
|
101
|
+
for (const node of this.nodes) {
|
|
100
102
|
const { message, browsers, identifier, hack } = node._stylehacks;
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
node.warn(
|
|
103
105
|
/** @type {import('postcss').Result} */ (this.result),
|
|
104
106
|
message + JSON.stringify({ browsers, identifier, hack })
|
|
105
107
|
);
|
|
106
|
-
}
|
|
108
|
+
}
|
|
107
109
|
}
|
|
108
110
|
};
|
|
@@ -22,26 +22,26 @@ module.exports = class LeadingStar extends BasePlugin {
|
|
|
22
22
|
if (node.type === DECL) {
|
|
23
23
|
// some values are not picked up by before, so ensure they are
|
|
24
24
|
// at the beginning of the value
|
|
25
|
-
|
|
25
|
+
for (const hack of hacks) {
|
|
26
26
|
if (!(/** @type Declaration */ (node).prop.indexOf(hack))) {
|
|
27
27
|
this.push(node, {
|
|
28
28
|
identifier: PROPERTY,
|
|
29
29
|
hack: /** @type Declaration */ (node).prop,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
const { before } = node.raws;
|
|
34
34
|
if (!before) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
for (const hack of hacks) {
|
|
38
38
|
if (before.includes(hack)) {
|
|
39
39
|
this.push(node, {
|
|
40
40
|
identifier: PROPERTY,
|
|
41
41
|
hack: `${before.trim()}${/** @type Declaration */ (node).prop}`,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
} else {
|
|
46
46
|
// test for the @property: value; hack
|
|
47
47
|
const { name } = /** @type AtRule */ (node);
|
package/types/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.js"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH;;;;;;GAMG;;IASC,6BAA6B;IACxB,KAAK,EADC,YAAY,EAAE;IAEpB,OAAO;IACP,SAAS;IACT,MAAM;IAVb;;;;OAIG;IACH,YAAY,OAAO,EAJR,MAAM,EAIE,EAAE,SAAS,EAHnB,MAAM,EAGa,EAAE,MAAM,AAFnC,CACF,EADU,OAAO,SAAS,EAAE,MAAM,YAEG,EAMrC;IAED;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAJE,OAAO,SAAS,EAAE,IAIpB,EAAE,QAAQ,EAHR;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAGzB,GAFP,IAAI,CAaf;IAED;;;OAGG;IACH,GAAG,CAAC,IAAI,EAHG,OAAO,SAAS,EAAE,IAGrB,GAFI,OAAO,CAUlB;IAED;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAHV,OAAO,SAAS,EAAE,IAGR,GAFT,IAAI,CAQf;IAED;;;OAGG;IACH,aAAa,CAAC,IAAI,EAHP,OAAO,SAAS,EAAE,IAGX,GAFN,IAAI,CAQf;IACD,2CAA2C;IAE3C,MAAM,CAAC,IAAI,EAFC,OAAO,SAAS,EAAE,IAEnB,QAEV;IAED,qBAAqB;I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