Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
css.eachRule(function(rule) {
if(rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name)) {
// ignore keyframe rules
return;
}
var selector = Tokenizer.parse(rule.selector);
var context = {
options: options,
global: globalMode,
hasPureGlobals: false
};
var newSelector;
try {
newSelector = localizeNode(selector, context);
} catch(e) {
throw rule.error(e.message);
}
if(pureMode && context.hasPureGlobals) {
throw rule.error("Selector '" + Tokenizer.stringify(selector) + "' is not pure " +
"(pure selectors must contain at least one local class or id)");
}
rule.nodes.forEach(function(decl) {
css.walkRules(function(rule) {
if(rule.parent.type === 'atrule' && /keyframes$/.test(rule.parent.name)) {
// ignore keyframe rules
return;
}
var selector = Tokenizer.parse(rule.selector);
var context = {
options: options,
global: globalMode,
hasPureGlobals: false
};
var newSelector;
try {
newSelector = localizeNode(selector, context);
} catch(e) {
throw rule.error(e.message);
}
if(pureMode && context.hasPureGlobals) {
throw rule.error('Selector "' + Tokenizer.stringify(selector) + '" is not pure ' +
'(pure selectors must contain at least one local class or id)');
}
// Less-syntax mixins parse as rules with no nodes
function localizeDecl(decl, context) {
var valuesNode = Tokenizer.parseValues(decl.value);
var localizeName = /animation(-name)?$/.test(decl.prop);
var newValuesNode = Object.create(valuesNode);
newValuesNode.nodes = valuesNode.nodes.map(function(valueNode) {
var subContext = {
options: context.options,
global: context.global,
localizeNextItem: localizeName && !context.global
};
return localizeDeclValue(valueNode, subContext);
});
decl.value = Tokenizer.stringifyValues(newValuesNode);
}
case "url":
if(!/^#/.test(item.url) && loaderUtils.isUrlRequest(item.url, options.root)) {
item.stringType = "";
delete item.innerSpacingBefore;
delete item.innerSpacingAfter;
var url = item.url;
item.url = "___CSS_LOADER_URL___" + urlItems.length + "___";
urlItems.push({
url: url
});
}
break;
}
});
});
decl.value = Tokenizer.stringifyValues(values);
});
css.eachAtRule(function(atrule) {
css.walkAtRules(/^import$/i, function(rule) {
var values = Tokenizer.parseValues(rule.params);
var url = values.nodes[0].nodes[0];
if(url && url.type === "url") {
url = url.url;
} else if(url && url.type === "string") {
url = url.value;
} else throw rule.error("Unexpected format " + rule.params);
if (!url.replace(/\s/g, '').length) {
return;
}
values.nodes[0].nodes.shift();
var mediaQuery = Tokenizer.stringifyValues(values);
if(loaderUtils.isUrlRequest(url, options.root)) {
url = loaderUtils.urlToRequest(url, options.root);
}
css.walkDecls(function(decl) {
var values = Tokenizer.parseValues(decl.value);
values.nodes.forEach(function(value) {
value.nodes.forEach(processNode);
});
decl.value = Tokenizer.stringifyValues(values);
});
css.walkAtRules(function(atrule) {
css.walkAtRules(/^import$/i, function(rule) {
var values = Tokenizer.parseValues(rule.params);
var url = values.nodes[0].nodes[0];
if(url && url.type === "url") {
url = url.url;
} else if(url && url.type === "string") {
url = url.value;
} else throw rule.error("Unexpected format " + rule.params);
if (!url.replace(/\s/g, '').length) {
return;
}
values.nodes[0].nodes.shift();
var mediaQuery = Tokenizer.stringifyValues(values);
if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
url = loaderUtils.urlToRequest(url, options.root);
}
importItems.push({
url: url,
css.walkAtRules(/^import$/i, function(rule) {
var values = Tokenizer.parseValues(rule.params);
var url = values.nodes[0].nodes[0];
if(url && url.type === "url") {
url = url.url;
} else if(url && url.type === "string") {
url = url.value;
} else throw rule.error("Unexpected format " + rule.params);
if (!url.replace(/\s/g, '').length) {
return;
}
values.nodes[0].nodes.shift();
var mediaQuery = Tokenizer.stringifyValues(values);
if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
url = loaderUtils.urlToRequest(url, options.root);
}
importItems.push({
url: url,
function getDependencyIdentifiersFromDeclarationValue(value) {
const node = css_selector_tokenizer_1.parseValues(value);
const accum = [];
findUrlsInNode(node, accum);
return accum;
}
exports.getDependencyIdentifiersFromDeclarationValue = getDependencyIdentifiersFromDeclarationValue;
css.walkAtRules(/^import$/i, function(rule) {
var values = Tokenizer.parseValues(rule.params);
var url = values.nodes[0].nodes[0];
if(url && url.type === "url") {
url = url.url;
} else if(url && url.type === "string") {
url = url.value;
} else throw rule.error("Unexpected format " + rule.params);
if (!url.replace(/\s/g, '').length) {
return;
}
values.nodes[0].nodes.shift();
var mediaQuery = Tokenizer.stringifyValues(values);
if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
url = loaderUtils.urlToRequest(url, options.root);
}
importItems.push({
url: url,