summaryrefslogtreecommitdiff
path: root/node_modules/stylehacks/src/plugins
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:10:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:41:44 +0800
commitfc87c009806dcc98867f6b58efe29b042aa01dee (patch)
tree8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/stylehacks/src/plugins
parent3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff)
node: updatemain
Diffstat (limited to 'node_modules/stylehacks/src/plugins')
-rw-r--r--node_modules/stylehacks/src/plugins/bodyEmpty.js49
-rw-r--r--node_modules/stylehacks/src/plugins/htmlCombinatorCommentBody.js54
-rw-r--r--node_modules/stylehacks/src/plugins/htmlFirstChild.js50
-rw-r--r--node_modules/stylehacks/src/plugins/important.js25
-rw-r--r--node_modules/stylehacks/src/plugins/index.js28
-rw-r--r--node_modules/stylehacks/src/plugins/leadingStar.js55
-rw-r--r--node_modules/stylehacks/src/plugins/leadingUnderscore.js51
-rw-r--r--node_modules/stylehacks/src/plugins/mediaSlash0.js26
-rw-r--r--node_modules/stylehacks/src/plugins/mediaSlash0Slash9.js27
-rw-r--r--node_modules/stylehacks/src/plugins/mediaSlash9.js27
-rw-r--r--node_modules/stylehacks/src/plugins/slash9.js26
-rw-r--r--node_modules/stylehacks/src/plugins/starHtml.js50
-rw-r--r--node_modules/stylehacks/src/plugins/trailingSlashComma.js36
13 files changed, 0 insertions, 504 deletions
diff --git a/node_modules/stylehacks/src/plugins/bodyEmpty.js b/node_modules/stylehacks/src/plugins/bodyEmpty.js
deleted file mode 100644
index edb40406..00000000
--- a/node_modules/stylehacks/src/plugins/bodyEmpty.js
+++ /dev/null
@@ -1,49 +0,0 @@
-'use strict';
-const parser = require('postcss-selector-parser');
-const exists = require('../exists');
-const isMixin = require('../isMixin');
-const BasePlugin = require('../plugin');
-const { FF_2 } = require('../dictionary/browsers');
-const { SELECTOR } = require('../dictionary/identifiers');
-const { RULE } = require('../dictionary/postcss');
-const { BODY } = require('../dictionary/tags');
-
-module.exports = class BodyEmpty extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([FF_2], [RULE], result);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {void}
- */
- detect(rule) {
- if (isMixin(rule)) {
- return;
- }
- parser(this.analyse(rule)).processSync(rule.selector);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {parser.SyncProcessor<void>}
- */
- analyse(rule) {
- return (selectors) => {
- selectors.each((selector) => {
- if (
- exists(selector, 0, BODY) &&
- exists(selector, 1, ':empty') &&
- exists(selector, 2, ' ') &&
- selector.at(3)
- ) {
- this.push(rule, {
- identifier: SELECTOR,
- hack: selector.toString(),
- });
- }
- });
- };
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/htmlCombinatorCommentBody.js b/node_modules/stylehacks/src/plugins/htmlCombinatorCommentBody.js
deleted file mode 100644
index e20d5535..00000000
--- a/node_modules/stylehacks/src/plugins/htmlCombinatorCommentBody.js
+++ /dev/null
@@ -1,54 +0,0 @@
-'use strict';
-const parser = require('postcss-selector-parser');
-const exists = require('../exists');
-const isMixin = require('../isMixin');
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
-const { SELECTOR } = require('../dictionary/identifiers');
-const { RULE } = require('../dictionary/postcss');
-const { BODY, HTML } = require('../dictionary/tags');
-
-module.exports = class HtmlCombinatorCommentBody extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7], [RULE], result);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {void}
- */
- detect(rule) {
- if (isMixin(rule)) {
- return;
- }
- if (rule.raws.selector && rule.raws.selector.raw) {
- parser(this.analyse(rule)).processSync(rule.raws.selector.raw);
- }
- }
-
- /** @param {import('postcss').Rule} rule
- * @return {parser.SyncProcessor<void>}
- */
- analyse(rule) {
- return (selectors) => {
- selectors.each((selector) => {
- if (
- exists(selector, 0, HTML) &&
- (exists(selector, 1, '>') || exists(selector, 1, '~')) &&
- selector.at(2) &&
- selector.at(2).type === 'comment' &&
- exists(selector, 3, ' ') &&
- exists(selector, 4, BODY) &&
- exists(selector, 5, ' ') &&
- selector.at(6)
- ) {
- this.push(rule, {
- identifier: SELECTOR,
- hack: selector.toString(),
- });
- }
- });
- };
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/htmlFirstChild.js b/node_modules/stylehacks/src/plugins/htmlFirstChild.js
deleted file mode 100644
index f772786b..00000000
--- a/node_modules/stylehacks/src/plugins/htmlFirstChild.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict';
-const parser = require('postcss-selector-parser');
-const exists = require('../exists');
-const isMixin = require('../isMixin');
-const BasePlugin = require('../plugin');
-const { OP_9 } = require('../dictionary/browsers');
-const { SELECTOR } = require('../dictionary/identifiers');
-const { RULE } = require('../dictionary/postcss');
-const { HTML } = require('../dictionary/tags');
-
-module.exports = class HtmlFirstChild extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([OP_9], [RULE], result);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {void}
- */
- detect(rule) {
- if (isMixin(rule)) {
- return;
- }
-
- parser(this.analyse(rule)).processSync(rule.selector);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {parser.SyncProcessor<void>}
- */
- analyse(rule) {
- return (selectors) => {
- selectors.each((selector) => {
- if (
- exists(selector, 0, HTML) &&
- exists(selector, 1, ':first-child') &&
- exists(selector, 2, ' ') &&
- selector.at(3)
- ) {
- this.push(rule, {
- identifier: SELECTOR,
- hack: selector.toString(),
- });
- }
- });
- };
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/important.js b/node_modules/stylehacks/src/plugins/important.js
deleted file mode 100644
index ab3745c9..00000000
--- a/node_modules/stylehacks/src/plugins/important.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
-const { DECL } = require('../dictionary/postcss');
-
-module.exports = class Important extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7], [DECL], result);
- }
- /**
- * @param {import('postcss').Declaration} decl
- * @return {void}
- */
- detect(decl) {
- const match = decl.value.match(/!\w/);
- if (match && match.index) {
- const hack = decl.value.substr(match.index, decl.value.length - 1);
- this.push(decl, {
- identifier: '!important',
- hack,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/index.js b/node_modules/stylehacks/src/plugins/index.js
deleted file mode 100644
index d09ad206..00000000
--- a/node_modules/stylehacks/src/plugins/index.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-const bodyEmpty = require('./bodyEmpty');
-const htmlCombinatorCommentBody = require('./htmlCombinatorCommentBody');
-const htmlFirstChild = require('./htmlFirstChild');
-const important = require('./important');
-const leadingStar = require('./leadingStar');
-const leadingUnderscore = require('./leadingUnderscore');
-const mediaSlash0 = require('./mediaSlash0');
-const mediaSlash0Slash9 = require('./mediaSlash0Slash9');
-const mediaSlash9 = require('./mediaSlash9');
-const slash9 = require('./slash9');
-const starHtml = require('./starHtml');
-const trailingSlashComma = require('./trailingSlashComma');
-
-module.exports = [
- bodyEmpty,
- htmlCombinatorCommentBody,
- htmlFirstChild,
- important,
- leadingStar,
- leadingUnderscore,
- mediaSlash0,
- mediaSlash0Slash9,
- mediaSlash9,
- slash9,
- starHtml,
- trailingSlashComma,
-];
diff --git a/node_modules/stylehacks/src/plugins/leadingStar.js b/node_modules/stylehacks/src/plugins/leadingStar.js
deleted file mode 100644
index 62064409..00000000
--- a/node_modules/stylehacks/src/plugins/leadingStar.js
+++ /dev/null
@@ -1,55 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
-const { PROPERTY } = require('../dictionary/identifiers');
-const { ATRULE, DECL } = require('../dictionary/postcss');
-
-const hacks = '!_$_&_*_)_=_%_+_,_._/_`_]_#_~_?_:_|'.split('_');
-
-module.exports = class LeadingStar extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7], [ATRULE, DECL], result);
- }
-
- /**
- * @param {import('postcss').Declaration | import('postcss').AtRule} node
- * @return {void}
- */
- detect(node) {
- if (node.type === DECL) {
- // some values are not picked up by before, so ensure they are
- // at the beginning of the value
- hacks.forEach((hack) => {
- if (!node.prop.indexOf(hack)) {
- this.push(node, {
- identifier: PROPERTY,
- hack: node.prop,
- });
- }
- });
- const { before } = node.raws;
- if (!before) {
- return;
- }
- hacks.forEach((hack) => {
- if (before.includes(hack)) {
- this.push(node, {
- identifier: PROPERTY,
- hack: `${before.trim()}${node.prop}`,
- });
- }
- });
- } else {
- // test for the @property: value; hack
- const { name } = node;
- const len = name.length - 1;
- if (name.lastIndexOf(':') === len) {
- this.push(node, {
- identifier: PROPERTY,
- hack: `@${name.substr(0, len)}`,
- });
- }
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/leadingUnderscore.js b/node_modules/stylehacks/src/plugins/leadingUnderscore.js
deleted file mode 100644
index ad09354f..00000000
--- a/node_modules/stylehacks/src/plugins/leadingUnderscore.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_6 } = require('../dictionary/browsers');
-const { PROPERTY } = require('../dictionary/identifiers');
-const { DECL } = require('../dictionary/postcss');
-
-/**
- * @param {string} prop
- * @return {string}
- */
-function vendorPrefix(prop) {
- let match = prop.match(/^(-\w+-)/);
- if (match) {
- return match[0];
- }
-
- return '';
-}
-
-module.exports = class LeadingUnderscore extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_6], [DECL], result);
- }
-
- /**
- * @param {import('postcss').Declaration} decl
- * @return {void}
- */
- detect(decl) {
- const { before } = decl.raws;
-
- if (before && before.includes('_')) {
- this.push(decl, {
- identifier: PROPERTY,
- hack: `${before.trim()}${decl.prop}`,
- });
- }
-
- if (
- decl.prop[0] === '-' &&
- decl.prop[1] !== '-' &&
- vendorPrefix(decl.prop) === ''
- ) {
- this.push(decl, {
- identifier: PROPERTY,
- hack: decl.prop,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/mediaSlash0.js b/node_modules/stylehacks/src/plugins/mediaSlash0.js
deleted file mode 100644
index c16b1828..00000000
--- a/node_modules/stylehacks/src/plugins/mediaSlash0.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_8 } = require('../dictionary/browsers');
-const { MEDIA_QUERY } = require('../dictionary/identifiers');
-const { ATRULE } = require('../dictionary/postcss');
-
-module.exports = class MediaSlash0 extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([IE_8], [ATRULE], result);
- }
- /**
- * @param {import('postcss').AtRule} rule
- * @return {void}
- */
- detect(rule) {
- const params = rule.params.trim();
-
- if (params.toLowerCase() === '\\0screen') {
- this.push(rule, {
- identifier: MEDIA_QUERY,
- hack: params,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/mediaSlash0Slash9.js b/node_modules/stylehacks/src/plugins/mediaSlash0Slash9.js
deleted file mode 100644
index 6f610023..00000000
--- a/node_modules/stylehacks/src/plugins/mediaSlash0Slash9.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6, IE_7, IE_8 } = require('../dictionary/browsers');
-const { MEDIA_QUERY } = require('../dictionary/identifiers');
-const { ATRULE } = require('../dictionary/postcss');
-
-module.exports = class MediaSlash0Slash9 extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7, IE_8], [ATRULE], result);
- }
-
- /**
- * @param {import('postcss').AtRule} rule
- * @return {void}
- */
- detect(rule) {
- const params = rule.params.trim();
-
- if (params.toLowerCase() === '\\0screen\\,screen\\9') {
- this.push(rule, {
- identifier: MEDIA_QUERY,
- hack: params,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/mediaSlash9.js b/node_modules/stylehacks/src/plugins/mediaSlash9.js
deleted file mode 100644
index ddad451e..00000000
--- a/node_modules/stylehacks/src/plugins/mediaSlash9.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
-const { MEDIA_QUERY } = require('../dictionary/identifiers');
-const { ATRULE } = require('../dictionary/postcss');
-
-module.exports = class MediaSlash9 extends BasePlugin {
- /** @param {import('postcss').Result} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7], [ATRULE], result);
- }
-
- /**
- * @param {import('postcss').AtRule} rule
- * @return {void}
- */
- detect(rule) {
- const params = rule.params.trim();
-
- if (params.toLowerCase() === 'screen\\9') {
- this.push(rule, {
- identifier: MEDIA_QUERY,
- hack: params,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/slash9.js b/node_modules/stylehacks/src/plugins/slash9.js
deleted file mode 100644
index 08e94626..00000000
--- a/node_modules/stylehacks/src/plugins/slash9.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin.js');
-const { IE_6, IE_7, IE_8 } = require('../dictionary/browsers');
-const { VALUE } = require('../dictionary/identifiers');
-const { DECL } = require('../dictionary/postcss');
-
-module.exports = class Slash9 extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_6, IE_7, IE_8], [DECL], result);
- }
-
- /**
- * @param {import('postcss').Declaration} decl
- * @return {void}
- */
- detect(decl) {
- let v = decl.value;
- if (v && v.length > 2 && v.indexOf('\\9') === v.length - 2) {
- this.push(decl, {
- identifier: VALUE,
- hack: v,
- });
- }
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/starHtml.js b/node_modules/stylehacks/src/plugins/starHtml.js
deleted file mode 100644
index 3de73d3c..00000000
--- a/node_modules/stylehacks/src/plugins/starHtml.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict';
-const parser = require('postcss-selector-parser');
-const exists = require('../exists');
-const isMixin = require('../isMixin');
-const BasePlugin = require('../plugin');
-const { IE_5_5, IE_6 } = require('../dictionary/browsers');
-const { SELECTOR } = require('../dictionary/identifiers');
-const { RULE } = require('../dictionary/postcss');
-const { HTML } = require('../dictionary/tags');
-
-module.exports = class StarHtml extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_5_5, IE_6], [RULE], result);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {void}
- */
- detect(rule) {
- if (isMixin(rule)) {
- return;
- }
- parser(this.analyse(rule)).processSync(rule.selector);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {parser.SyncProcessor<void>}
- */
- analyse(rule) {
- return (selectors) => {
- selectors.each((selector) => {
- if (
- exists(selector, 0, '*') &&
- exists(selector, 1, ' ') &&
- exists(selector, 2, HTML) &&
- exists(selector, 3, ' ') &&
- selector.at(4)
- ) {
- this.push(rule, {
- identifier: SELECTOR,
- hack: selector.toString(),
- });
- }
- });
- };
- }
-};
diff --git a/node_modules/stylehacks/src/plugins/trailingSlashComma.js b/node_modules/stylehacks/src/plugins/trailingSlashComma.js
deleted file mode 100644
index 0d75c47b..00000000
--- a/node_modules/stylehacks/src/plugins/trailingSlashComma.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict';
-const BasePlugin = require('../plugin');
-const isMixin = require('../isMixin');
-const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
-const { SELECTOR } = require('../dictionary/identifiers');
-const { RULE } = require('../dictionary/postcss');
-
-module.exports = class TrailingSlashComma extends BasePlugin {
- /** @param {import('postcss').Result=} result */
- constructor(result) {
- super([IE_5_5, IE_6, IE_7], [RULE], result);
- }
-
- /**
- * @param {import('postcss').Rule} rule
- * @return {void}
- */
- detect(rule) {
- if (isMixin(rule)) {
- return;
- }
-
- const { selector } = rule;
- const trim = selector.trim();
-
- if (
- trim.lastIndexOf(',') === selector.length - 1 ||
- trim.lastIndexOf('\\') === selector.length - 1
- ) {
- this.push(rule, {
- identifier: SELECTOR,
- hack: selector,
- });
- }
- }
-};