stylehacks 5.0.3 → 5.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.
Files changed (40) hide show
  1. package/LICENSE-MIT +0 -0
  2. package/README.md +0 -0
  3. package/package.json +6 -5
  4. package/src/exists.js +7 -0
  5. package/src/index.js +10 -0
  6. package/src/isMixin.js +4 -0
  7. package/src/plugin.js +55 -7
  8. package/src/plugins/bodyEmpty.js +9 -0
  9. package/src/plugins/htmlCombinatorCommentBody.js +8 -0
  10. package/src/plugins/htmlFirstChild.js +9 -0
  11. package/src/plugins/important.js +6 -2
  12. package/src/plugins/leadingStar.js +8 -3
  13. package/src/plugins/leadingUnderscore.js +9 -0
  14. package/src/plugins/mediaSlash0.js +5 -1
  15. package/src/plugins/mediaSlash0Slash9.js +5 -0
  16. package/src/plugins/mediaSlash9.js +5 -0
  17. package/src/plugins/slash9.js +5 -0
  18. package/src/plugins/starHtml.js +9 -0
  19. package/src/plugins/trailingSlashComma.js +5 -0
  20. package/types/dictionary/browsers.d.ts +6 -0
  21. package/types/dictionary/identifiers.d.ts +4 -0
  22. package/types/dictionary/postcss.d.ts +3 -0
  23. package/types/dictionary/tags.d.ts +2 -0
  24. package/types/exists.d.ts +2 -0
  25. package/types/index.d.ts +16 -0
  26. package/types/isMixin.d.ts +2 -0
  27. package/types/plugin.d.ts +60 -0
  28. package/types/plugins/bodyEmpty.d.ts +17 -0
  29. package/types/plugins/htmlCombinatorCommentBody.d.ts +16 -0
  30. package/types/plugins/htmlFirstChild.d.ts +17 -0
  31. package/types/plugins/important.d.ts +11 -0
  32. package/types/plugins/index.d.ts +6 -0
  33. package/types/plugins/leadingStar.d.ts +11 -0
  34. package/types/plugins/leadingUnderscore.d.ts +11 -0
  35. package/types/plugins/mediaSlash0.d.ts +11 -0
  36. package/types/plugins/mediaSlash0Slash9.d.ts +11 -0
  37. package/types/plugins/mediaSlash9.d.ts +11 -0
  38. package/types/plugins/slash9.d.ts +11 -0
  39. package/types/plugins/starHtml.d.ts +17 -0
  40. package/types/plugins/trailingSlashComma.d.ts +11 -0
package/LICENSE-MIT CHANGED
File without changes
package/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "stylehacks",
3
- "version": "5.0.3",
3
+ "version": "5.1.1",
4
4
  "description": "Detect/remove browser hacks from CSS files.",
5
5
  "main": "src/index.js",
6
+ "types": "types/index.d.ts",
6
7
  "files": [
7
8
  "LICENSE-MIT",
8
- "src"
9
+ "src",
10
+ "types"
9
11
  ],
10
12
  "keywords": [
11
13
  "browsers",
@@ -26,7 +28,7 @@
26
28
  },
27
29
  "repository": "cssnano/cssnano",
28
30
  "dependencies": {
29
- "browserslist": "^4.16.6",
31
+ "browserslist": "^4.21.4",
30
32
  "postcss-selector-parser": "^6.0.4"
31
33
  },
32
34
  "bugs": {
@@ -40,6 +42,5 @@
40
42
  },
41
43
  "peerDependencies": {
42
44
  "postcss": "^8.2.15"
43
- },
44
- "readme": "# stylehacks\n\n> Detect/remove browser hacks from CSS files.\n\n\n## Install\n\nWith [npm](https://npmjs.org/package/stylehacks) do:\n\n```\nnpm install stylehacks --save\n```\n\n\n## Example\n\nIn its default mode, stylehacks will remove hacks from your CSS file, based on\nthe browsers that you wish to support.\n\n### Input\n\n```css\nh1 {\n _color: white;\n color: rgba(255, 255, 255, 0.5);\n}\n```\n\n### Output\n\n```css\nh1 {\n color: rgba(255, 255, 255, 0.5);\n}\n```\n\n\n## API\n\n### `stylehacks.detect(node)`\n\nType: `function` \nReturns: `boolean`\n\nThis method will take any PostCSS *node*, run applicable plugins depending on\nits type, then will return a boolean depending on whether it found any of\nthe supported hacks. For example, if the `decl` node found below is passed to\nthe `detect` function, it will return `true`. But if the `rule` node is passed,\nit will return `false` instead.\n\n```css\nh1 { _color: red }\n```\n\n### `postcss([ stylehacks(opts) ])`\n\nstylehacks can also be consumed as a PostCSS plugin. See the\n[documentation](https://github.com/postcss/postcss#usage) for examples for\nyour environment.\n\n#### options\n\n##### lint\n\nType: `boolean` \nDefault: `false`\n\nIf lint mode is enabled, stylehacks will not remove hacks from the CSS; instead,\nit will add warnings to `Result#messages`.\n\n\n## Related\n\nstylehacks works well with your existing PostCSS setup:\n\n* [stylelint] - Comprehensive & modern CSS linter, to ensure that your code\n style rules are respected.\n\n\n## Contributing\n\nPull requests are welcome. If you add functionality, then please add unit tests\nto cover it.\n\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n\n[stylelint]: https://github.com/stylelint/stylelint\n"
45
+ }
45
46
  }
package/src/exists.js CHANGED
@@ -1,4 +1,11 @@
1
1
  'use strict';
2
+
3
+ /**
4
+ * @param {import('postcss-selector-parser').Selector} selector
5
+ * @param {number} index
6
+ * @param {string} value
7
+ * @return {boolean | undefined | ''}
8
+ */
2
9
  module.exports = function exists(selector, index, value) {
3
10
  const node = selector.at(index);
4
11
 
package/src/index.js CHANGED
@@ -2,11 +2,19 @@
2
2
  const browserslist = require('browserslist');
3
3
  const plugins = require('./plugins');
4
4
 
5
+ /** @typedef {{lint?: boolean}} Options */
6
+
7
+ /**
8
+ * @type {import('postcss').PluginCreator<Options>}
9
+ * @param {Options} opts
10
+ * @return {import('postcss').Plugin}
11
+ */
5
12
  function pluginCreator(opts = {}) {
6
13
  return {
7
14
  postcssPlugin: 'stylehacks',
8
15
 
9
16
  OnceExit(css, { result }) {
17
+ /** @type {typeof result.opts & browserslist.Options} */
10
18
  const resultOpts = result.opts || {};
11
19
  const browsers = browserslist(null, {
12
20
  stats: resultOpts.stats,
@@ -14,6 +22,7 @@ function pluginCreator(opts = {}) {
14
22
  env: resultOpts.env,
15
23
  });
16
24
 
25
+ /** @type {import('./plugin').Plugin[]} */
17
26
  const processors = [];
18
27
  for (const Plugin of plugins) {
19
28
  const hack = new Plugin(result);
@@ -38,6 +47,7 @@ function pluginCreator(opts = {}) {
38
47
  };
39
48
  }
40
49
 
50
+ /** @type {(node: import('postcss').Node) => boolean} */
41
51
  pluginCreator.detect = (node) => {
42
52
  return plugins.some((Plugin) => {
43
53
  const hack = new Plugin();
package/src/isMixin.js CHANGED
@@ -1,4 +1,8 @@
1
1
  'use strict';
2
+ /**
3
+ * @param {import('postcss').Rule} node
4
+ * @return {boolean}
5
+ */
2
6
  module.exports = function isMixin(node) {
3
7
  const { selector } = node;
4
8
 
package/src/plugin.js CHANGED
@@ -1,31 +1,70 @@
1
1
  'use strict';
2
+ /**
3
+ * @typedef {object} Plugin
4
+ * @prop {Set<string>} targets
5
+ * @prop {Set<string>} nodeTypes
6
+ * @prop {(node: import('postcss').Node) => void} detectAndResolve
7
+ * @prop {(node: import('postcss').Node) => void} detectAndWarn
8
+ */
9
+
10
+ /**
11
+ * @typedef {import('postcss').Node & {_stylehacks: {
12
+ message: string,
13
+ browsers: Set<string>,
14
+ identifier: string,
15
+ hack: string }}} NodeWithInfo
16
+ */
17
+
2
18
  module.exports = class BasePlugin {
19
+ /**
20
+ * @param {string[]} targets
21
+ * @param {string[]} nodeTypes
22
+ * @param {import('postcss').Result=} result
23
+ */
3
24
  constructor(targets, nodeTypes, result) {
25
+ /** @type {NodeWithInfo[]} */
4
26
  this.nodes = [];
5
27
  this.targets = new Set(targets);
6
28
  this.nodeTypes = new Set(nodeTypes);
7
29
  this.result = result;
8
30
  }
9
31
 
32
+ /**
33
+ * @param {import('postcss').Node} node
34
+ * @param {{identifier: string, hack: string}} metadata
35
+ * @return {void}
36
+ */
10
37
  push(node, metadata) {
11
- node._stylehacks = Object.assign({}, metadata, {
12
- message: `Bad ${metadata.identifier}: ${metadata.hack}`,
13
- browsers: this.targets,
14
- });
38
+ /** @type {NodeWithInfo} */ (node)._stylehacks = Object.assign(
39
+ {},
40
+ metadata,
41
+ {
42
+ message: `Bad ${metadata.identifier}: ${metadata.hack}`,
43
+ browsers: this.targets,
44
+ }
45
+ );
15
46
 
16
- this.nodes.push(node);
47
+ this.nodes.push(/** @type {NodeWithInfo} */ (node));
17
48
  }
18
49
 
50
+ /**
51
+ * @param {import('postcss').Node} node
52
+ * @return {boolean}
53
+ */
19
54
  any(node) {
20
55
  if (this.nodeTypes.has(node.type)) {
21
56
  this.detect(node);
22
57
 
23
- return !!node._stylehacks;
58
+ return /** @type {NodeWithInfo} */ (node)._stylehacks !== undefined;
24
59
  }
25
60
 
26
61
  return false;
27
62
  }
28
63
 
64
+ /**
65
+ * @param {import('postcss').Node} node
66
+ * @return {void}
67
+ */
29
68
  detectAndResolve(node) {
30
69
  this.nodes = [];
31
70
 
@@ -34,6 +73,10 @@ module.exports = class BasePlugin {
34
73
  return this.resolve();
35
74
  }
36
75
 
76
+ /**
77
+ * @param {import('postcss').Node} node
78
+ * @return {void}
79
+ */
37
80
  detectAndWarn(node) {
38
81
  this.nodes = [];
39
82
 
@@ -41,11 +84,13 @@ module.exports = class BasePlugin {
41
84
 
42
85
  return this.warn();
43
86
  }
87
+ /** @param {import('postcss').Node} node */
44
88
  // eslint-disable-next-line no-unused-vars
45
89
  detect(node) {
46
90
  throw new Error('You need to implement this method in a subclass.');
47
91
  }
48
92
 
93
+ /** @return {void} */
49
94
  resolve() {
50
95
  return this.nodes.forEach((node) => node.remove());
51
96
  }
@@ -54,7 +99,10 @@ module.exports = class BasePlugin {
54
99
  return this.nodes.forEach((node) => {
55
100
  const { message, browsers, identifier, hack } = node._stylehacks;
56
101
 
57
- return node.warn(this.result, message, { browsers, identifier, hack });
102
+ return node.warn(
103
+ /** @type {import('postcss').Result} */ (this.result),
104
+ message + JSON.stringify({ browsers, identifier, hack })
105
+ );
58
106
  });
59
107
  }
60
108
  };
@@ -9,10 +9,15 @@ const { RULE } = require('../dictionary/postcss');
9
9
  const { BODY } = require('../dictionary/tags');
10
10
 
11
11
  module.exports = class BodyEmpty extends BasePlugin {
12
+ /** @param {import('postcss').Result} result */
12
13
  constructor(result) {
13
14
  super([FF_2], [RULE], result);
14
15
  }
15
16
 
17
+ /**
18
+ * @param {import('postcss').Rule} rule
19
+ * @return {void}
20
+ */
16
21
  detect(rule) {
17
22
  if (isMixin(rule)) {
18
23
  return;
@@ -20,6 +25,10 @@ module.exports = class BodyEmpty extends BasePlugin {
20
25
  parser(this.analyse(rule)).processSync(rule.selector);
21
26
  }
22
27
 
28
+ /**
29
+ * @param {import('postcss').Rule} rule
30
+ * @return {parser.SyncProcessor<void>}
31
+ */
23
32
  analyse(rule) {
24
33
  return (selectors) => {
25
34
  selectors.each((selector) => {
@@ -9,10 +9,15 @@ const { RULE } = require('../dictionary/postcss');
9
9
  const { BODY, HTML } = require('../dictionary/tags');
10
10
 
11
11
  module.exports = class HtmlCombinatorCommentBody extends BasePlugin {
12
+ /** @param {import('postcss').Result} result */
12
13
  constructor(result) {
13
14
  super([IE_5_5, IE_6, IE_7], [RULE], result);
14
15
  }
15
16
 
17
+ /**
18
+ * @param {import('postcss').Rule} rule
19
+ * @return {void}
20
+ */
16
21
  detect(rule) {
17
22
  if (isMixin(rule)) {
18
23
  return;
@@ -22,6 +27,9 @@ module.exports = class HtmlCombinatorCommentBody extends BasePlugin {
22
27
  }
23
28
  }
24
29
 
30
+ /** @param {import('postcss').Rule} rule
31
+ * @return {parser.SyncProcessor<void>}
32
+ */
25
33
  analyse(rule) {
26
34
  return (selectors) => {
27
35
  selectors.each((selector) => {
@@ -9,10 +9,15 @@ const { RULE } = require('../dictionary/postcss');
9
9
  const { HTML } = require('../dictionary/tags');
10
10
 
11
11
  module.exports = class HtmlFirstChild extends BasePlugin {
12
+ /** @param {import('postcss').Result} result */
12
13
  constructor(result) {
13
14
  super([OP_9], [RULE], result);
14
15
  }
15
16
 
17
+ /**
18
+ * @param {import('postcss').Rule} rule
19
+ * @return {void}
20
+ */
16
21
  detect(rule) {
17
22
  if (isMixin(rule)) {
18
23
  return;
@@ -21,6 +26,10 @@ module.exports = class HtmlFirstChild extends BasePlugin {
21
26
  parser(this.analyse(rule)).processSync(rule.selector);
22
27
  }
23
28
 
29
+ /**
30
+ * @param {import('postcss').Rule} rule
31
+ * @return {parser.SyncProcessor<void>}
32
+ */
24
33
  analyse(rule) {
25
34
  return (selectors) => {
26
35
  selectors.each((selector) => {
@@ -4,13 +4,17 @@ const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
4
4
  const { DECL } = require('../dictionary/postcss');
5
5
 
6
6
  module.exports = class Important extends BasePlugin {
7
+ /** @param {import('postcss').Result=} result */
7
8
  constructor(result) {
8
9
  super([IE_5_5, IE_6, IE_7], [DECL], result);
9
10
  }
10
-
11
+ /**
12
+ * @param {import('postcss').Declaration} decl
13
+ * @return {void}
14
+ */
11
15
  detect(decl) {
12
16
  const match = decl.value.match(/!\w/);
13
- if (match) {
17
+ if (match && match.index) {
14
18
  const hack = decl.value.substr(match.index, decl.value.length - 1);
15
19
  this.push(decl, {
16
20
  identifier: '!important',
@@ -7,10 +7,15 @@ const { ATRULE, DECL } = require('../dictionary/postcss');
7
7
  const hacks = '!_$_&_*_)_=_%_+_,_._/_`_]_#_~_?_:_|'.split('_');
8
8
 
9
9
  module.exports = class LeadingStar extends BasePlugin {
10
+ /** @param {import('postcss').Result=} result */
10
11
  constructor(result) {
11
12
  super([IE_5_5, IE_6, IE_7], [ATRULE, DECL], result);
12
13
  }
13
14
 
15
+ /**
16
+ * @param {import('postcss').Declaration | import('postcss').AtRule} node
17
+ * @return {void}
18
+ */
14
19
  detect(node) {
15
20
  if (node.type === DECL) {
16
21
  // some values are not picked up by before, so ensure they are
@@ -23,7 +28,7 @@ module.exports = class LeadingStar extends BasePlugin {
23
28
  });
24
29
  }
25
30
  });
26
- let { before } = node.raws;
31
+ const { before } = node.raws;
27
32
  if (!before) {
28
33
  return;
29
34
  }
@@ -37,8 +42,8 @@ module.exports = class LeadingStar extends BasePlugin {
37
42
  });
38
43
  } else {
39
44
  // test for the @property: value; hack
40
- let { name } = node;
41
- let len = name.length - 1;
45
+ const { name } = node;
46
+ const len = name.length - 1;
42
47
  if (name.lastIndexOf(':') === len) {
43
48
  this.push(node, {
44
49
  identifier: PROPERTY,
@@ -4,6 +4,10 @@ const { IE_6 } = require('../dictionary/browsers');
4
4
  const { PROPERTY } = require('../dictionary/identifiers');
5
5
  const { DECL } = require('../dictionary/postcss');
6
6
 
7
+ /**
8
+ * @param {string} prop
9
+ * @return {string}
10
+ */
7
11
  function vendorPrefix(prop) {
8
12
  let match = prop.match(/^(-\w+-)/);
9
13
  if (match) {
@@ -14,10 +18,15 @@ function vendorPrefix(prop) {
14
18
  }
15
19
 
16
20
  module.exports = class LeadingUnderscore extends BasePlugin {
21
+ /** @param {import('postcss').Result=} result */
17
22
  constructor(result) {
18
23
  super([IE_6], [DECL], result);
19
24
  }
20
25
 
26
+ /**
27
+ * @param {import('postcss').Declaration} decl
28
+ * @return {void}
29
+ */
21
30
  detect(decl) {
22
31
  const { before } = decl.raws;
23
32
 
@@ -5,10 +5,14 @@ const { MEDIA_QUERY } = require('../dictionary/identifiers');
5
5
  const { ATRULE } = require('../dictionary/postcss');
6
6
 
7
7
  module.exports = class MediaSlash0 extends BasePlugin {
8
+ /** @param {import('postcss').Result} result */
8
9
  constructor(result) {
9
10
  super([IE_8], [ATRULE], result);
10
11
  }
11
-
12
+ /**
13
+ * @param {import('postcss').AtRule} rule
14
+ * @return {void}
15
+ */
12
16
  detect(rule) {
13
17
  const params = rule.params.trim();
14
18
 
@@ -5,10 +5,15 @@ const { MEDIA_QUERY } = require('../dictionary/identifiers');
5
5
  const { ATRULE } = require('../dictionary/postcss');
6
6
 
7
7
  module.exports = class MediaSlash0Slash9 extends BasePlugin {
8
+ /** @param {import('postcss').Result} result */
8
9
  constructor(result) {
9
10
  super([IE_5_5, IE_6, IE_7, IE_8], [ATRULE], result);
10
11
  }
11
12
 
13
+ /**
14
+ * @param {import('postcss').AtRule} rule
15
+ * @return {void}
16
+ */
12
17
  detect(rule) {
13
18
  const params = rule.params.trim();
14
19
 
@@ -5,10 +5,15 @@ const { MEDIA_QUERY } = require('../dictionary/identifiers');
5
5
  const { ATRULE } = require('../dictionary/postcss');
6
6
 
7
7
  module.exports = class MediaSlash9 extends BasePlugin {
8
+ /** @param {import('postcss').Result} result */
8
9
  constructor(result) {
9
10
  super([IE_5_5, IE_6, IE_7], [ATRULE], result);
10
11
  }
11
12
 
13
+ /**
14
+ * @param {import('postcss').AtRule} rule
15
+ * @return {void}
16
+ */
12
17
  detect(rule) {
13
18
  const params = rule.params.trim();
14
19
 
@@ -5,10 +5,15 @@ const { VALUE } = require('../dictionary/identifiers');
5
5
  const { DECL } = require('../dictionary/postcss');
6
6
 
7
7
  module.exports = class Slash9 extends BasePlugin {
8
+ /** @param {import('postcss').Result=} result */
8
9
  constructor(result) {
9
10
  super([IE_6, IE_7, IE_8], [DECL], result);
10
11
  }
11
12
 
13
+ /**
14
+ * @param {import('postcss').Declaration} decl
15
+ * @return {void}
16
+ */
12
17
  detect(decl) {
13
18
  let v = decl.value;
14
19
  if (v && v.length > 2 && v.indexOf('\\9') === v.length - 2) {
@@ -9,10 +9,15 @@ const { RULE } = require('../dictionary/postcss');
9
9
  const { HTML } = require('../dictionary/tags');
10
10
 
11
11
  module.exports = class StarHtml extends BasePlugin {
12
+ /** @param {import('postcss').Result=} result */
12
13
  constructor(result) {
13
14
  super([IE_5_5, IE_6], [RULE], result);
14
15
  }
15
16
 
17
+ /**
18
+ * @param {import('postcss').Rule} rule
19
+ * @return {void}
20
+ */
16
21
  detect(rule) {
17
22
  if (isMixin(rule)) {
18
23
  return;
@@ -20,6 +25,10 @@ module.exports = class StarHtml extends BasePlugin {
20
25
  parser(this.analyse(rule)).processSync(rule.selector);
21
26
  }
22
27
 
28
+ /**
29
+ * @param {import('postcss').Rule} rule
30
+ * @return {parser.SyncProcessor<void>}
31
+ */
23
32
  analyse(rule) {
24
33
  return (selectors) => {
25
34
  selectors.each((selector) => {
@@ -6,10 +6,15 @@ const { SELECTOR } = require('../dictionary/identifiers');
6
6
  const { RULE } = require('../dictionary/postcss');
7
7
 
8
8
  module.exports = class TrailingSlashComma extends BasePlugin {
9
+ /** @param {import('postcss').Result=} result */
9
10
  constructor(result) {
10
11
  super([IE_5_5, IE_6, IE_7], [RULE], result);
11
12
  }
12
13
 
14
+ /**
15
+ * @param {import('postcss').Rule} rule
16
+ * @return {void}
17
+ */
13
18
  detect(rule) {
14
19
  if (isMixin(rule)) {
15
20
  return;
@@ -0,0 +1,6 @@
1
+ export const FF_2: "firefox 2";
2
+ export const IE_5_5: "ie 5.5";
3
+ export const IE_6: "ie 6";
4
+ export const IE_7: "ie 7";
5
+ export const IE_8: "ie 8";
6
+ export const OP_9: "opera 9";
@@ -0,0 +1,4 @@
1
+ export const MEDIA_QUERY: "media query";
2
+ export const PROPERTY: "property";
3
+ export const SELECTOR: "selector";
4
+ export const VALUE: "value";
@@ -0,0 +1,3 @@
1
+ export const ATRULE: "atrule";
2
+ export const DECL: "decl";
3
+ export const RULE: "rule";
@@ -0,0 +1,2 @@
1
+ export const BODY: "body";
2
+ export const HTML: "html";
@@ -0,0 +1,2 @@
1
+ declare function _exports(selector: import('postcss-selector-parser').Selector, index: number, value: string): boolean | undefined | '';
2
+ export = _exports;
@@ -0,0 +1,16 @@
1
+ export = pluginCreator;
2
+ /** @typedef {{lint?: boolean}} Options */
3
+ /**
4
+ * @type {import('postcss').PluginCreator<Options>}
5
+ * @param {Options} opts
6
+ * @return {import('postcss').Plugin}
7
+ */
8
+ declare function pluginCreator(opts?: Options): import('postcss').Plugin;
9
+ declare namespace pluginCreator {
10
+ export { detect, postcss, Options };
11
+ }
12
+ type Options = {
13
+ lint?: boolean;
14
+ };
15
+ declare function detect(node: import('postcss').Node): boolean;
16
+ declare var postcss: true;
@@ -0,0 +1,2 @@
1
+ declare function _exports(node: import('postcss').Rule): boolean;
2
+ export = _exports;
@@ -0,0 +1,60 @@
1
+ export = BasePlugin;
2
+ declare class BasePlugin {
3
+ /**
4
+ * @param {string[]} targets
5
+ * @param {string[]} nodeTypes
6
+ * @param {import('postcss').Result=} result
7
+ */
8
+ constructor(targets: string[], nodeTypes: string[], result?: import('postcss').Result | undefined);
9
+ /** @type {NodeWithInfo[]} */
10
+ nodes: NodeWithInfo[];
11
+ targets: Set<string>;
12
+ nodeTypes: Set<string>;
13
+ result: import("postcss").Result | undefined;
14
+ /**
15
+ * @param {import('postcss').Node} node
16
+ * @param {{identifier: string, hack: string}} metadata
17
+ * @return {void}
18
+ */
19
+ push(node: import('postcss').Node, metadata: {
20
+ identifier: string;
21
+ hack: string;
22
+ }): void;
23
+ /**
24
+ * @param {import('postcss').Node} node
25
+ * @return {boolean}
26
+ */
27
+ any(node: import('postcss').Node): boolean;
28
+ /**
29
+ * @param {import('postcss').Node} node
30
+ * @return {void}
31
+ */
32
+ detectAndResolve(node: import('postcss').Node): void;
33
+ /**
34
+ * @param {import('postcss').Node} node
35
+ * @return {void}
36
+ */
37
+ detectAndWarn(node: import('postcss').Node): void;
38
+ /** @param {import('postcss').Node} node */
39
+ detect(node: import('postcss').Node): void;
40
+ /** @return {void} */
41
+ resolve(): void;
42
+ warn(): void;
43
+ }
44
+ declare namespace BasePlugin {
45
+ export { Plugin, NodeWithInfo };
46
+ }
47
+ type NodeWithInfo = import('postcss').Node & {
48
+ _stylehacks: {
49
+ message: string;
50
+ browsers: Set<string>;
51
+ identifier: string;
52
+ hack: string;
53
+ };
54
+ };
55
+ type Plugin = {
56
+ targets: Set<string>;
57
+ nodeTypes: Set<string>;
58
+ detectAndResolve: (node: import('postcss').Node) => void;
59
+ detectAndWarn: (node: import('postcss').Node) => void;
60
+ };
@@ -0,0 +1,17 @@
1
+ export = BodyEmpty;
2
+ declare class BodyEmpty extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').Rule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').Rule): void;
10
+ /**
11
+ * @param {import('postcss').Rule} rule
12
+ * @return {parser.SyncProcessor<void>}
13
+ */
14
+ analyse(rule: import('postcss').Rule): parser.SyncProcessor<void>;
15
+ }
16
+ import BasePlugin = require("../plugin");
17
+ import parser = require("postcss-selector-parser");
@@ -0,0 +1,16 @@
1
+ export = HtmlCombinatorCommentBody;
2
+ declare class HtmlCombinatorCommentBody extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').Rule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').Rule): void;
10
+ /** @param {import('postcss').Rule} rule
11
+ * @return {parser.SyncProcessor<void>}
12
+ */
13
+ analyse(rule: import('postcss').Rule): parser.SyncProcessor<void>;
14
+ }
15
+ import BasePlugin = require("../plugin");
16
+ import parser = require("postcss-selector-parser");
@@ -0,0 +1,17 @@
1
+ export = HtmlFirstChild;
2
+ declare class HtmlFirstChild extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').Rule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').Rule): void;
10
+ /**
11
+ * @param {import('postcss').Rule} rule
12
+ * @return {parser.SyncProcessor<void>}
13
+ */
14
+ analyse(rule: import('postcss').Rule): parser.SyncProcessor<void>;
15
+ }
16
+ import BasePlugin = require("../plugin");
17
+ import parser = require("postcss-selector-parser");
@@ -0,0 +1,11 @@
1
+ export = Important;
2
+ declare class Important extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Declaration} decl
7
+ * @return {void}
8
+ */
9
+ detect(decl: import('postcss').Declaration): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,6 @@
1
+ declare const _exports: ({
2
+ new (result?: import("postcss").Result | undefined): important;
3
+ } | {
4
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
5
+ })[];
6
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ export = LeadingStar;
2
+ declare class LeadingStar extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Declaration | import('postcss').AtRule} node
7
+ * @return {void}
8
+ */
9
+ detect(node: import('postcss').Declaration | import('postcss').AtRule): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,11 @@
1
+ export = LeadingUnderscore;
2
+ declare class LeadingUnderscore extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Declaration} decl
7
+ * @return {void}
8
+ */
9
+ detect(decl: import('postcss').Declaration): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,11 @@
1
+ export = MediaSlash0;
2
+ declare class MediaSlash0 extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').AtRule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').AtRule): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,11 @@
1
+ export = MediaSlash0Slash9;
2
+ declare class MediaSlash0Slash9 extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').AtRule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').AtRule): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,11 @@
1
+ export = MediaSlash9;
2
+ declare class MediaSlash9 extends BasePlugin {
3
+ /** @param {import('postcss').Result} result */
4
+ constructor(result: import('postcss').Result);
5
+ /**
6
+ * @param {import('postcss').AtRule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').AtRule): void;
10
+ }
11
+ import BasePlugin = require("../plugin");
@@ -0,0 +1,11 @@
1
+ export = Slash9;
2
+ declare class Slash9 extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Declaration} decl
7
+ * @return {void}
8
+ */
9
+ detect(decl: import('postcss').Declaration): void;
10
+ }
11
+ import BasePlugin = require("../plugin.js");
@@ -0,0 +1,17 @@
1
+ export = StarHtml;
2
+ declare class StarHtml extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Rule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').Rule): void;
10
+ /**
11
+ * @param {import('postcss').Rule} rule
12
+ * @return {parser.SyncProcessor<void>}
13
+ */
14
+ analyse(rule: import('postcss').Rule): parser.SyncProcessor<void>;
15
+ }
16
+ import BasePlugin = require("../plugin");
17
+ import parser = require("postcss-selector-parser");
@@ -0,0 +1,11 @@
1
+ export = TrailingSlashComma;
2
+ declare class TrailingSlashComma extends BasePlugin {
3
+ /** @param {import('postcss').Result=} result */
4
+ constructor(result?: import('postcss').Result | undefined);
5
+ /**
6
+ * @param {import('postcss').Rule} rule
7
+ * @return {void}
8
+ */
9
+ detect(rule: import('postcss').Rule): void;
10
+ }
11
+ import BasePlugin = require("../plugin");