stylehacks 5.0.3 → 5.1.0

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 (38) hide show
  1. package/package.json +4 -2
  2. package/src/exists.js +7 -0
  3. package/src/index.js +10 -0
  4. package/src/isMixin.js +4 -0
  5. package/src/plugin.js +55 -7
  6. package/src/plugins/bodyEmpty.js +9 -0
  7. package/src/plugins/htmlCombinatorCommentBody.js +8 -0
  8. package/src/plugins/htmlFirstChild.js +9 -0
  9. package/src/plugins/important.js +6 -2
  10. package/src/plugins/leadingStar.js +8 -3
  11. package/src/plugins/leadingUnderscore.js +9 -0
  12. package/src/plugins/mediaSlash0.js +5 -1
  13. package/src/plugins/mediaSlash0Slash9.js +5 -0
  14. package/src/plugins/mediaSlash9.js +5 -0
  15. package/src/plugins/slash9.js +5 -0
  16. package/src/plugins/starHtml.js +9 -0
  17. package/src/plugins/trailingSlashComma.js +5 -0
  18. package/types/dictionary/browsers.d.ts +6 -0
  19. package/types/dictionary/identifiers.d.ts +4 -0
  20. package/types/dictionary/postcss.d.ts +3 -0
  21. package/types/dictionary/tags.d.ts +2 -0
  22. package/types/exists.d.ts +2 -0
  23. package/types/index.d.ts +16 -0
  24. package/types/isMixin.d.ts +2 -0
  25. package/types/plugin.d.ts +60 -0
  26. package/types/plugins/bodyEmpty.d.ts +17 -0
  27. package/types/plugins/htmlCombinatorCommentBody.d.ts +16 -0
  28. package/types/plugins/htmlFirstChild.d.ts +17 -0
  29. package/types/plugins/important.d.ts +11 -0
  30. package/types/plugins/index.d.ts +365 -0
  31. package/types/plugins/leadingStar.d.ts +11 -0
  32. package/types/plugins/leadingUnderscore.d.ts +11 -0
  33. package/types/plugins/mediaSlash0.d.ts +11 -0
  34. package/types/plugins/mediaSlash0Slash9.d.ts +11 -0
  35. package/types/plugins/mediaSlash9.d.ts +11 -0
  36. package/types/plugins/slash9.d.ts +11 -0
  37. package/types/plugins/starHtml.d.ts +17 -0
  38. package/types/plugins/trailingSlashComma.d.ts +11 -0
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "stylehacks",
3
- "version": "5.0.3",
3
+ "version": "5.1.0",
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",
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,365 @@
1
+ declare const _exports: {
2
+ [n: number]: {
3
+ new (result?: import("postcss").Result | undefined): important;
4
+ } | {
5
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
6
+ };
7
+ length: number;
8
+ toString(): string;
9
+ toLocaleString(): string;
10
+ pop(): {
11
+ new (result?: import("postcss").Result | undefined): important;
12
+ } | {
13
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
14
+ } | undefined;
15
+ push(...items: ({
16
+ new (result?: import("postcss").Result | undefined): important;
17
+ } | {
18
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
19
+ })[]): number;
20
+ concat(...items: ConcatArray<{
21
+ new (result?: import("postcss").Result | undefined): important;
22
+ } | {
23
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
24
+ }>[]): ({
25
+ new (result?: import("postcss").Result | undefined): important;
26
+ } | {
27
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
28
+ })[];
29
+ concat(...items: ({
30
+ new (result?: import("postcss").Result | undefined): important;
31
+ } | {
32
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
33
+ } | ConcatArray<{
34
+ new (result?: import("postcss").Result | undefined): important;
35
+ } | {
36
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
37
+ }>)[]): ({
38
+ new (result?: import("postcss").Result | undefined): important;
39
+ } | {
40
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
41
+ })[];
42
+ join(separator?: string | undefined): string;
43
+ reverse(): ({
44
+ new (result?: import("postcss").Result | undefined): important;
45
+ } | {
46
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
47
+ })[];
48
+ shift(): {
49
+ new (result?: import("postcss").Result | undefined): important;
50
+ } | {
51
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
52
+ } | undefined;
53
+ slice(start?: number | undefined, end?: number | undefined): ({
54
+ new (result?: import("postcss").Result | undefined): important;
55
+ } | {
56
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
57
+ })[];
58
+ sort(compareFn?: ((a: {
59
+ new (result?: import("postcss").Result | undefined): important;
60
+ } | {
61
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
62
+ }, b: {
63
+ new (result?: import("postcss").Result | undefined): important;
64
+ } | {
65
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
66
+ }) => number) | undefined): ({
67
+ new (result?: import("postcss").Result | undefined): important;
68
+ } | {
69
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
70
+ })[];
71
+ splice(start: number, deleteCount?: number | undefined): ({
72
+ new (result?: import("postcss").Result | undefined): important;
73
+ } | {
74
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
75
+ })[];
76
+ splice(start: number, deleteCount: number, ...items: ({
77
+ new (result?: import("postcss").Result | undefined): important;
78
+ } | {
79
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
80
+ })[]): ({
81
+ new (result?: import("postcss").Result | undefined): important;
82
+ } | {
83
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
84
+ })[];
85
+ unshift(...items: ({
86
+ new (result?: import("postcss").Result | undefined): important;
87
+ } | {
88
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
89
+ })[]): number;
90
+ indexOf(searchElement: {
91
+ new (result?: import("postcss").Result | undefined): important;
92
+ } | {
93
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
94
+ }, fromIndex?: number | undefined): number;
95
+ lastIndexOf(searchElement: {
96
+ new (result?: import("postcss").Result | undefined): important;
97
+ } | {
98
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
99
+ }, fromIndex?: number | undefined): number;
100
+ every<S extends {
101
+ new (result?: import("postcss").Result | undefined): important;
102
+ } | {
103
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
104
+ }>(predicate: (value: {
105
+ new (result?: import("postcss").Result | undefined): important;
106
+ } | {
107
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
108
+ }, index: number, array: ({
109
+ new (result?: import("postcss").Result | undefined): important;
110
+ } | {
111
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
112
+ })[]) => value is S, thisArg?: any): this is S[];
113
+ every(predicate: (value: {
114
+ new (result?: import("postcss").Result | undefined): important;
115
+ } | {
116
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
117
+ }, index: number, array: ({
118
+ new (result?: import("postcss").Result | undefined): important;
119
+ } | {
120
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
121
+ })[]) => unknown, thisArg?: any): boolean;
122
+ some(predicate: (value: {
123
+ new (result?: import("postcss").Result | undefined): important;
124
+ } | {
125
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
126
+ }, index: number, array: ({
127
+ new (result?: import("postcss").Result | undefined): important;
128
+ } | {
129
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
130
+ })[]) => unknown, thisArg?: any): boolean;
131
+ forEach(callbackfn: (value: {
132
+ new (result?: import("postcss").Result | undefined): important;
133
+ } | {
134
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
135
+ }, index: number, array: ({
136
+ new (result?: import("postcss").Result | undefined): important;
137
+ } | {
138
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
139
+ })[]) => void, thisArg?: any): void;
140
+ map<U>(callbackfn: (value: {
141
+ new (result?: import("postcss").Result | undefined): important;
142
+ } | {
143
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
144
+ }, index: number, array: ({
145
+ new (result?: import("postcss").Result | undefined): important;
146
+ } | {
147
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
148
+ })[]) => U, thisArg?: any): U[];
149
+ filter<S_1 extends {
150
+ new (result?: import("postcss").Result | undefined): important;
151
+ } | {
152
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
153
+ }>(predicate: (value: {
154
+ new (result?: import("postcss").Result | undefined): important;
155
+ } | {
156
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
157
+ }, index: number, array: ({
158
+ new (result?: import("postcss").Result | undefined): important;
159
+ } | {
160
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
161
+ })[]) => value is S_1, thisArg?: any): S_1[];
162
+ filter(predicate: (value: {
163
+ new (result?: import("postcss").Result | undefined): important;
164
+ } | {
165
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
166
+ }, index: number, array: ({
167
+ new (result?: import("postcss").Result | undefined): important;
168
+ } | {
169
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
170
+ })[]) => unknown, thisArg?: any): ({
171
+ new (result?: import("postcss").Result | undefined): important;
172
+ } | {
173
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
174
+ })[];
175
+ reduce(callbackfn: (previousValue: {
176
+ new (result?: import("postcss").Result | undefined): important;
177
+ } | {
178
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
179
+ }, currentValue: {
180
+ new (result?: import("postcss").Result | undefined): important;
181
+ } | {
182
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
183
+ }, currentIndex: number, array: ({
184
+ new (result?: import("postcss").Result | undefined): important;
185
+ } | {
186
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
187
+ })[]) => {
188
+ new (result?: import("postcss").Result | undefined): important;
189
+ } | {
190
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
191
+ }): {
192
+ new (result?: import("postcss").Result | undefined): important;
193
+ } | {
194
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
195
+ };
196
+ reduce(callbackfn: (previousValue: {
197
+ new (result?: import("postcss").Result | undefined): important;
198
+ } | {
199
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
200
+ }, currentValue: {
201
+ new (result?: import("postcss").Result | undefined): important;
202
+ } | {
203
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
204
+ }, currentIndex: number, array: ({
205
+ new (result?: import("postcss").Result | undefined): important;
206
+ } | {
207
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
208
+ })[]) => {
209
+ new (result?: import("postcss").Result | undefined): important;
210
+ } | {
211
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
212
+ }, initialValue: {
213
+ new (result?: import("postcss").Result | undefined): important;
214
+ } | {
215
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
216
+ }): {
217
+ new (result?: import("postcss").Result | undefined): important;
218
+ } | {
219
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
220
+ };
221
+ reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: {
222
+ new (result?: import("postcss").Result | undefined): important;
223
+ } | {
224
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
225
+ }, currentIndex: number, array: ({
226
+ new (result?: import("postcss").Result | undefined): important;
227
+ } | {
228
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
229
+ })[]) => U_1, initialValue: U_1): U_1;
230
+ reduceRight(callbackfn: (previousValue: {
231
+ new (result?: import("postcss").Result | undefined): important;
232
+ } | {
233
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
234
+ }, currentValue: {
235
+ new (result?: import("postcss").Result | undefined): important;
236
+ } | {
237
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
238
+ }, currentIndex: number, array: ({
239
+ new (result?: import("postcss").Result | undefined): important;
240
+ } | {
241
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
242
+ })[]) => {
243
+ new (result?: import("postcss").Result | undefined): important;
244
+ } | {
245
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
246
+ }): {
247
+ new (result?: import("postcss").Result | undefined): important;
248
+ } | {
249
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
250
+ };
251
+ reduceRight(callbackfn: (previousValue: {
252
+ new (result?: import("postcss").Result | undefined): important;
253
+ } | {
254
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
255
+ }, currentValue: {
256
+ new (result?: import("postcss").Result | undefined): important;
257
+ } | {
258
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
259
+ }, currentIndex: number, array: ({
260
+ new (result?: import("postcss").Result | undefined): important;
261
+ } | {
262
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
263
+ })[]) => {
264
+ new (result?: import("postcss").Result | undefined): important;
265
+ } | {
266
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
267
+ }, initialValue: {
268
+ new (result?: import("postcss").Result | undefined): important;
269
+ } | {
270
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
271
+ }): {
272
+ new (result?: import("postcss").Result | undefined): important;
273
+ } | {
274
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
275
+ };
276
+ reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: {
277
+ new (result?: import("postcss").Result | undefined): important;
278
+ } | {
279
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
280
+ }, currentIndex: number, array: ({
281
+ new (result?: import("postcss").Result | undefined): important;
282
+ } | {
283
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
284
+ })[]) => U_2, initialValue: U_2): U_2;
285
+ find<S_2 extends {
286
+ new (result?: import("postcss").Result | undefined): important;
287
+ } | {
288
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
289
+ }>(predicate: (this: void, value: {
290
+ new (result?: import("postcss").Result | undefined): important;
291
+ } | {
292
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
293
+ }, index: number, obj: ({
294
+ new (result?: import("postcss").Result | undefined): important;
295
+ } | {
296
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
297
+ })[]) => value is S_2, thisArg?: any): S_2 | undefined;
298
+ find(predicate: (value: {
299
+ new (result?: import("postcss").Result | undefined): important;
300
+ } | {
301
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
302
+ }, index: number, obj: ({
303
+ new (result?: import("postcss").Result | undefined): important;
304
+ } | {
305
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
306
+ })[]) => unknown, thisArg?: any): {
307
+ new (result?: import("postcss").Result | undefined): important;
308
+ } | {
309
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
310
+ } | undefined;
311
+ findIndex(predicate: (value: {
312
+ new (result?: import("postcss").Result | undefined): important;
313
+ } | {
314
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
315
+ }, index: number, obj: ({
316
+ new (result?: import("postcss").Result | undefined): important;
317
+ } | {
318
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
319
+ })[]) => unknown, thisArg?: any): number;
320
+ fill(value: {
321
+ new (result?: import("postcss").Result | undefined): important;
322
+ } | {
323
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
324
+ }, start?: number | undefined, end?: number | undefined): ({
325
+ new (result?: import("postcss").Result | undefined): important;
326
+ } | {
327
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
328
+ })[];
329
+ copyWithin(target: number, start: number, end?: number | undefined): ({
330
+ new (result?: import("postcss").Result | undefined): important;
331
+ } | {
332
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
333
+ })[];
334
+ entries(): IterableIterator<[number, {
335
+ new (result?: import("postcss").Result | undefined): important;
336
+ } | {
337
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
338
+ }]>;
339
+ keys(): IterableIterator<number>;
340
+ values(): IterableIterator<{
341
+ new (result?: import("postcss").Result | undefined): important;
342
+ } | {
343
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
344
+ }>;
345
+ includes(searchElement: {
346
+ new (result?: import("postcss").Result | undefined): important;
347
+ } | {
348
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
349
+ }, fromIndex?: number | undefined): boolean;
350
+ [Symbol.iterator](): IterableIterator<{
351
+ new (result?: import("postcss").Result | undefined): important;
352
+ } | {
353
+ new (result?: import("postcss").Result | undefined): trailingSlashComma;
354
+ }>;
355
+ [Symbol.unscopables](): {
356
+ copyWithin: boolean;
357
+ entries: boolean;
358
+ fill: boolean;
359
+ find: boolean;
360
+ findIndex: boolean;
361
+ keys: boolean;
362
+ values: boolean;
363
+ };
364
+ };
365
+ 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");