Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import postcss from 'postcss';
import valueParser from 'postcss-value-parser';
import {block as commentRegex} from 'comment-regex';
import applyTransformFeatures from './applyTransformFeatures';
import blank from './blank';
import getIndent from './getIndent';
import isSassVariable from './isSassVariable';
import longest from './longest';
import {maxAtRuleLength, maxSelectorLength, maxValueLength} from './maxSelectorLength';
import prefixedDecls from './prefixedDecls';
import space from './space';
import sameLine from './sameLine';
import walk from './walk';
const {unprefixed} = postcss.vendor;
export default function applyExpanded (css, opts) {
css.walk(rule => {
const {raws, type} = rule;
if (type === 'decl') {
if (raws.value) {
rule.value = raws.value.raw.trim();
}
// Format sass variable `$size: 30em;`
if (isSassVariable(rule)) {
if (rule !== css.first) {
rule.raws.before = '\n';
}
rule.raws.between = ': ';
}
}
if (child.type !== "decl") {
return
}
const prop = child.prop
if (!isStandardSyntaxProperty(prop)) {
return
}
if (isCustomProperty(prop)) {
return
}
let unprefixedPropName = postcss.vendor.unprefixed(prop)
// Hack to allow -moz-osx-font-smoothing to be understood
// just like -webkit-font-smoothing
if (unprefixedPropName.indexOf("osx-") === 0) {
unprefixedPropName = unprefixedPropName.slice(4)
}
const propData = {
name: prop,
unprefixedName: unprefixedPropName,
orderData: alphabetical ? null : getOrderData(expectedOrder, unprefixedPropName),
before: child.raws.before,
index: allPropData.length,
node: child,
}
it('exposes the postcss helper functions as static methods', function() {
expect(PostCss.plugin).toBe(originalPostcss.plugin);
expect(PostCss.vendor).toBe(originalPostcss.vendor);
expect(PostCss.parse).toBe(originalPostcss.parse);
expect(PostCss.list).toBe(originalPostcss.list);
expect(PostCss.comment).toBe(originalPostcss.comment);
expect(PostCss.atRule).toBe(originalPostcss.atRule);
expect(PostCss.decl).toBe(originalPostcss.decl);
expect(PostCss.rule).toBe(originalPostcss.rule);
expect(PostCss.root).toBe(originalPostcss.root);
});
) {
return;
}
let prevPseudoElement = pseudoNode;
do {
prevPseudoElement = prevPseudoElement.prev();
if (prevPseudoElement && prevPseudoElement.value.slice(0, 2) === '::') {
break;
}
} while (prevPseudoElement);
if (prevPseudoElement) {
const prevPseudoElementValue = postcss.vendor.unprefixed(
prevPseudoElement.value.toLowerCase().slice(2),
);
if (
keywordSets.webkitProprietaryPseudoElements.has(prevPseudoElementValue) &&
keywordSets.webkitProprietaryPseudoClasses.has(name)
) {
return;
}
}
index = pseudoNode.sourceIndex;
}
report({
message: messages.rejected(value),
"use strict";
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var parser = require('postcss-value-parser');
var vendor = require('postcss').vendor;
var list = require('postcss').list;
var Transition =
/*#__PURE__*/
function () {
function Transition(prefixes) {
_defineProperty(this, "props", ['transition', 'transition-property']);
this.prefixes = prefixes;
}
/**
* Process transition and add prefixes for all necessary properties
*/
var Processor = require('./processor');
var Supports = require('./supports');
var Browsers = require('./browsers');
var Selector = require('./selector');
var AtRule = require('./at-rule');
var Value = require('./value');
var utils = require('./utils');
var vendor = require('postcss').vendor;
Selector.hack(require('./hacks/fullscreen'));
Selector.hack(require('./hacks/placeholder'));
Declaration.hack(require('./hacks/flex'));
Declaration.hack(require('./hacks/order'));
Declaration.hack(require('./hacks/filter'));
Declaration.hack(require('./hacks/grid-end'));
Declaration.hack(require('./hacks/animation'));
Declaration.hack(require('./hacks/flex-flow'));
Declaration.hack(require('./hacks/flex-grow'));
Declaration.hack(require('./hacks/flex-wrap'));
Declaration.hack(require('./hacks/grid-area'));
Declaration.hack(require('./hacks/place-self'));
Declaration.hack(require('./hacks/grid-start'));
Declaration.hack(require('./hacks/align-self'));
Declaration.hack(require('./hacks/appearance'));
valueParser(value).walk(function(node) {
if (node.type !== 'function') {
return;
}
if (!isStandardSyntaxFunction(node)) {
return;
}
if (!matchesStringOrRegExp(postcss.vendor.unprefixed(node.value), blacklist)) {
return;
}
report({
message: messages.rejected(node.value),
node: decl,
index: declarationValueIndex(decl) + node.sourceIndex,
result,
ruleName,
});
});
});
if (optionsMatches(options, 'ignorePseudoClasses', pseudoNode.value.slice(1))) {
return;
}
let index = null;
const name = value.slice(1).toLowerCase();
if (node.type === 'atrule' && node.name === 'page') {
if (keywordSets.atRulePagePseudoClasses.has(name)) {
return;
}
index = atRuleParamIndex(node) + pseudoNode.sourceIndex;
} else {
if (
postcss.vendor.prefix(name) ||
keywordSets.pseudoClasses.has(name) ||
keywordSets.pseudoElements.has(name)
) {
return;
}
let prevPseudoElement = pseudoNode;
do {
prevPseudoElement = prevPseudoElement.prev();
if (prevPseudoElement && prevPseudoElement.value.slice(0, 2) === '::') {
break;
}
} while (prevPseudoElement);
valueParser(value).walk(node => {
if (node.type !== "function") {
return;
}
if (!isStandardSyntaxFunction(node)) {
return;
}
if (postcss.vendor.unprefixed(node.value) !== negativeVar) {
return;
}
report({
message: messages.rejected,
node: decl,
index: declarationValueIndex(decl) + node.sourceIndex,
result,
ruleName
});
});
});
root.walkDecls((decl) => {
const prop = decl.prop;
const value = decl.value;
const unprefixedProp = postcss.vendor.unprefixed(prop);
const propBlacklist = _.find(blacklist, (list, propIdentifier) =>
matchesStringOrRegExp(unprefixedProp, propIdentifier),
);
if (_.isEmpty(propBlacklist)) {
return;
}
if (!matchesStringOrRegExp(value, propBlacklist)) {
return;
}
report({
message: messages.rejected(prop, value),
node: decl,
result,