stylehacks 6.0.3 → 6.1.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 +3 -3
- package/src/index.js +37 -26
- package/types/dictionary/browsers.d.ts +1 -0
- package/types/dictionary/browsers.d.ts.map +1 -0
- package/types/dictionary/identifiers.d.ts +1 -0
- package/types/dictionary/identifiers.d.ts.map +1 -0
- package/types/dictionary/postcss.d.ts +1 -0
- package/types/dictionary/postcss.d.ts.map +1 -0
- package/types/dictionary/tags.d.ts +1 -0
- package/types/dictionary/tags.d.ts.map +1 -0
- package/types/exists.d.ts +1 -0
- package/types/exists.d.ts.map +1 -0
- package/types/index.d.ts +13 -3
- package/types/index.d.ts.map +1 -0
- package/types/isMixin.d.ts +1 -0
- package/types/isMixin.d.ts.map +1 -0
- package/types/plugin.d.ts +2 -1
- package/types/plugin.d.ts.map +1 -0
- package/types/plugins/bodyEmpty.d.ts +1 -0
- package/types/plugins/bodyEmpty.d.ts.map +1 -0
- package/types/plugins/htmlCombinatorCommentBody.d.ts +1 -0
- package/types/plugins/htmlCombinatorCommentBody.d.ts.map +1 -0
- package/types/plugins/htmlFirstChild.d.ts +1 -0
- package/types/plugins/htmlFirstChild.d.ts.map +1 -0
- package/types/plugins/important.d.ts +1 -0
- package/types/plugins/important.d.ts.map +1 -0
- package/types/plugins/index.d.ts +3 -2
- package/types/plugins/index.d.ts.map +1 -0
- package/types/plugins/leadingStar.d.ts +1 -0
- package/types/plugins/leadingStar.d.ts.map +1 -0
- package/types/plugins/leadingUnderscore.d.ts +1 -0
- package/types/plugins/leadingUnderscore.d.ts.map +1 -0
- package/types/plugins/mediaSlash0.d.ts +1 -0
- package/types/plugins/mediaSlash0.d.ts.map +1 -0
- package/types/plugins/mediaSlash0Slash9.d.ts +1 -0
- package/types/plugins/mediaSlash0Slash9.d.ts.map +1 -0
- package/types/plugins/mediaSlash9.d.ts +1 -0
- package/types/plugins/mediaSlash9.d.ts.map +1 -0
- package/types/plugins/slash9.d.ts +1 -0
- package/types/plugins/slash9.d.ts.map +1 -0
- package/types/plugins/starHtml.d.ts +1 -0
- package/types/plugins/starHtml.d.ts.map +1 -0
- package/types/plugins/trailingSlashComma.d.ts +1 -0
- package/types/plugins/trailingSlashComma.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylehacks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Detect/remove browser hacks from CSS files.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"repository": "cssnano/cssnano",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"browserslist": "^4.23.0",
|
|
32
|
-
"postcss-selector-parser": "^6.0.
|
|
32
|
+
"postcss-selector-parser": "^6.0.16"
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": "^14 || ^16 || >=18.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"postcss": "^8.4.
|
|
41
|
+
"postcss": "^8.4.37"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"postcss": "^8.4.31"
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
const { dirname } = require('path');
|
|
2
3
|
const browserslist = require('browserslist');
|
|
3
4
|
const plugins = require('./plugins');
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
|
|
8
|
+
* @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
|
|
9
|
+
* @typedef {{lint?: boolean} & AutoprefixerOptions & BrowserslistOptions} Options
|
|
10
|
+
*/
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* @type {import('postcss').PluginCreator<Options>}
|
|
@@ -13,36 +18,42 @@ function pluginCreator(opts = {}) {
|
|
|
13
18
|
return {
|
|
14
19
|
postcssPlugin: 'stylehacks',
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result
|
|
23
|
+
*/
|
|
24
|
+
prepare(result) {
|
|
25
|
+
const { stats, env, from, file } = result.opts || {};
|
|
26
|
+
const browsers = browserslist(opts.overrideBrowserslist, {
|
|
27
|
+
stats: opts.stats || stats,
|
|
28
|
+
path: opts.path || dirname(from || file || __filename),
|
|
29
|
+
env: opts.env || env,
|
|
23
30
|
});
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
processors.forEach((proc) => {
|
|
35
|
-
if (!proc.nodeTypes.has(node.type)) {
|
|
36
|
-
return;
|
|
32
|
+
return {
|
|
33
|
+
OnceExit(css) {
|
|
34
|
+
/** @type {import('./plugin').Plugin[]} */
|
|
35
|
+
const processors = [];
|
|
36
|
+
for (const Plugin of plugins) {
|
|
37
|
+
const hack = new Plugin(result);
|
|
38
|
+
if (!browsers.some((browser) => hack.targets.has(browser))) {
|
|
39
|
+
processors.push(hack);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
42
|
+
css.walk((node) => {
|
|
43
|
+
processors.forEach((proc) => {
|
|
44
|
+
if (!proc.nodeTypes.has(node.type)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
if (opts.lint) {
|
|
49
|
+
return proc.detectAndWarn(node);
|
|
50
|
+
}
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
return proc.detectAndResolve(node);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
};
|
|
46
57
|
},
|
|
47
58
|
};
|
|
48
59
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsers.d.ts","sourceRoot":"","sources":["../../src/dictionary/browsers.js"],"names":[],"mappings":"AACA,+BAAyB;AACzB,8BAAwB;AACxB,0BAAoB;AACpB,0BAAoB;AACpB,0BAAoB;AACpB,6BAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../../src/dictionary/identifiers.js"],"names":[],"mappings":"AACA,wCAAkC;AAClC,kCAA4B;AAC5B,kCAA4B;AAC5B,4BAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcss.d.ts","sourceRoot":"","sources":["../../src/dictionary/postcss.js"],"names":[],"mappings":"AACA,8BAAwB;AACxB,0BAAoB;AACpB,0BAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/dictionary/tags.js"],"names":[],"mappings":"AACA,0BAAoB;AACpB,0BAAoB"}
|
package/types/exists.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../src/exists.js"],"names":[],"mappings":"AAQiB,oCALN,OAAO,yBAAyB,EAAE,QAAQ,SAC1C,MAAM,SACN,MAAM,GACL,OAAO,GAAG,SAAS,GAAG,EAAE,CAMnC"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export = pluginCreator;
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
|
|
4
|
+
* @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
|
|
5
|
+
* @typedef {{lint?: boolean} & AutoprefixerOptions & BrowserslistOptions} Options
|
|
6
|
+
*/
|
|
3
7
|
/**
|
|
4
8
|
* @type {import('postcss').PluginCreator<Options>}
|
|
5
9
|
* @param {Options} opts
|
|
@@ -7,10 +11,16 @@ export = pluginCreator;
|
|
|
7
11
|
*/
|
|
8
12
|
declare function pluginCreator(opts?: Options): import('postcss').Plugin;
|
|
9
13
|
declare namespace pluginCreator {
|
|
10
|
-
export { detect, postcss, Options };
|
|
14
|
+
export { detect, postcss, AutoprefixerOptions, BrowserslistOptions, Options };
|
|
11
15
|
}
|
|
12
16
|
type Options = {
|
|
13
17
|
lint?: boolean;
|
|
14
|
-
};
|
|
18
|
+
} & AutoprefixerOptions & BrowserslistOptions;
|
|
15
19
|
declare function detect(node: import('postcss').Node): boolean;
|
|
16
20
|
declare var postcss: true;
|
|
21
|
+
type AutoprefixerOptions = {
|
|
22
|
+
overrideBrowserslist?: string | string[];
|
|
23
|
+
};
|
|
24
|
+
type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>;
|
|
25
|
+
import browserslist = require("browserslist");
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAKA;;;;GAIG;AAEH;;;;GAIG;AACH,sCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CA4CnC;;;;eAlDY;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAC,GAAG,mBAAmB,GAAG,mBAAmB;AAoD9D,8BAAO,OAAO,SAAS,EAAE,IAAI,GAAK,OAAO,CAAA;;2BAtDvC;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}
|
package/types/isMixin.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMixin.d.ts","sourceRoot":"","sources":["../src/isMixin.js"],"names":[],"mappings":"AAKiB,gCAHN,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,CAWlB"}
|
package/types/plugin.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare class BasePlugin {
|
|
|
10
10
|
nodes: NodeWithInfo[];
|
|
11
11
|
targets: Set<string>;
|
|
12
12
|
nodeTypes: Set<string>;
|
|
13
|
-
result: import("postcss
|
|
13
|
+
result: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* @param {import('postcss').Node} node
|
|
16
16
|
* @param {{identifier: string, hack: string}} metadata
|
|
@@ -58,3 +58,4 @@ type Plugin = {
|
|
|
58
58
|
detectAndResolve: (node: import('postcss').Node) => void;
|
|
59
59
|
detectAndWarn: (node: import('postcss').Node) => void;
|
|
60
60
|
};
|
|
61
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.js"],"names":[],"mappings":";AAiBiB;IACf;;;;OAIG;IACH,qBAJW,MAAM,EAAE,aACR,MAAM,EAAE,WACR,OAAO,SAAS,EAAE,MAAM,cAQlC;IALC,6BAA6B;IAC7B,OADW,YAAY,EAAE,CACV;IACf,qBAA+B;IAC/B,uBAAmC;IACnC,kGAAoB;IAGtB;;;;OAIG;IACH,WAJW,OAAO,SAAS,EAAE,IAAI,YACtB;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GACjC,IAAI,CAaf;IAED;;;OAGG;IACH,UAHW,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,CAUlB;IAED;;;OAGG;IACH,uBAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAQf;IAED;;;OAGG;IACH,oBAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAQf;IACD,2CAA2C;IAE3C,aAFY,OAAO,SAAS,EAAE,IAAI,QAIjC;IAED,qBAAqB;IACrB,WADa,IAAI,CAGhB;IAED,aASC;CACF;;;;oBAjGY,OAAO,SAAS,EAAE,IAAI,GAAG;IAAC,WAAW,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,IAAI,MAAM,CAAC,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAC;;aAX/C,IAAI,MAAM,CAAC;eACX,IAAI,MAAM,CAAC;6BACJ,OAAO,SAAS,EAAE,IAAI,KAAK,IAAI;0BAC/B,OAAO,SAAS,EAAE,IAAI,KAAK,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodyEmpty.d.ts","sourceRoot":"","sources":["../../src/plugins/bodyEmpty.js"],"names":[],"mappings":";AAUiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAOf;IAED;;;OAGG;IACH,cAHW,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,aAAa,CAAC,IAAI,CAAC,CAkBrC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlCombinatorCommentBody.d.ts","sourceRoot":"","sources":["../../src/plugins/htmlCombinatorCommentBody.js"],"names":[],"mappings":";AAUiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CASf;IAED;;OAEG;IACH,cAHY,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,aAAa,CAAC,IAAI,CAAC,CAsBtC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlFirstChild.d.ts","sourceRoot":"","sources":["../../src/plugins/htmlFirstChild.js"],"names":[],"mappings":";AAUiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAQf;IAED;;;OAGG;IACH,cAHW,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,aAAa,CAAC,IAAI,CAAC,CAkBrC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"important.d.ts","sourceRoot":"","sources":["../../src/plugins/important.js"],"names":[],"mappings":";AAKiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IACD;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,WAAW,GAC5B,IAAI,CAWf;CACF"}
|
package/types/plugins/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
declare const _exports: ({
|
|
2
|
-
new (result?: import("postcss
|
|
2
|
+
new (result?: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined): important;
|
|
3
3
|
} | {
|
|
4
|
-
new (result?: import("postcss
|
|
4
|
+
new (result?: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined): trailingSlashComma;
|
|
5
5
|
})[];
|
|
6
6
|
export = _exports;
|
|
7
7
|
import important = require("./important");
|
|
8
8
|
import trailingSlashComma = require("./trailingSlashComma");
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leadingStar.d.ts","sourceRoot":"","sources":["../../src/plugins/leadingStar.js"],"names":[],"mappings":";AAQiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,WAAW,GAAG,OAAO,SAAS,EAAE,MAAM,GACvD,IAAI,CAqCf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leadingUnderscore.d.ts","sourceRoot":"","sources":["../../src/plugins/leadingUnderscore.js"],"names":[],"mappings":";AAmBiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,WAAW,GAC5B,IAAI,CAsBf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaSlash0.d.ts","sourceRoot":"","sources":["../../src/plugins/mediaSlash0.js"],"names":[],"mappings":";AAMiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IACD;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,MAAM,GACvB,IAAI,CAWf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaSlash0Slash9.d.ts","sourceRoot":"","sources":["../../src/plugins/mediaSlash0Slash9.js"],"names":[],"mappings":";AAMiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,MAAM,GACvB,IAAI,CAWf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaSlash9.d.ts","sourceRoot":"","sources":["../../src/plugins/mediaSlash9.js"],"names":[],"mappings":";AAMiB;IACf,+CAA+C;IAC/C,oBADY,OAAO,SAAS,EAAE,MAAM,EAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,MAAM,GACvB,IAAI,CAWf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash9.d.ts","sourceRoot":"","sources":["../../src/plugins/slash9.js"],"names":[],"mappings":";AAMiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,WAAW,GAC5B,IAAI,CAUf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starHtml.d.ts","sourceRoot":"","sources":["../../src/plugins/starHtml.js"],"names":[],"mappings":";AAUiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAOf;IAED;;;OAGG;IACH,cAHW,OAAO,SAAS,EAAE,IAAI,GACrB,OAAO,aAAa,CAAC,IAAI,CAAC,CAmBrC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailingSlashComma.d.ts","sourceRoot":"","sources":["../../src/plugins/trailingSlashComma.js"],"names":[],"mappings":";AAOiB;IACf,gDAAgD;IAChD,qBADY,OAAO,SAAS,EAAE,MAAM,cAGnC;IAED;;;OAGG;IACH,aAHW,OAAO,SAAS,EAAE,IAAI,GACrB,IAAI,CAmBf;CACF"}
|