isStandardSyntaxRule.cjs 683 B

123456789101112131415161718192021222324252627282930
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const isStandardSyntaxSelector = require('./isStandardSyntaxSelector.cjs');
  5. /**
  6. * Check whether a Node is a standard rule
  7. *
  8. * @param {import('postcss').Rule | import('postcss-less').Rule} rule
  9. * @returns {boolean}
  10. */
  11. function isStandardSyntaxRule(rule) {
  12. if (rule.type !== 'rule') {
  13. return false;
  14. }
  15. // Ignore Less &:extend rule
  16. if ('extend' in rule && rule.extend) {
  17. return false;
  18. }
  19. if (!isStandardSyntaxSelector(rule.selector)) {
  20. return false;
  21. }
  22. return true;
  23. }
  24. module.exports = isStandardSyntaxRule;