Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function stringifySelector(ast: SelectorAstNode): string {
return tokenizer.stringify(ast);
}
function localizeRule (rule) {
const selector = Tokenizer.parse(rule.selector)
let scopedSelector
try {
scopedSelector = localizeNode(selector)
} catch (e) {
throw rule.error(e.message)
}
rule.selector = Tokenizer.stringify(scopedSelector)
}
const localizeSelectors = (selectors, mode, getAlias) => {
const node = Tokenizer.parse(selectors);
return Tokenizer.stringify(
Object.assign({}, node, {
nodes: node.nodes.map(n => localizeNode(n, { mode, getAlias }))
})
);
};
newNodes = node.nodes.map(function(n) {
var nContext = {
global: context.global,
lastWasSpacing: true,
hasLocals: false,
explicit: false
};
n = localizeNode(n, nContext);
if(typeof resultingGlobal === 'undefined') {
resultingGlobal = nContext.global;
} else if(resultingGlobal !== nContext.global) {
throw new Error('Inconsistent rule global/local result in rule "' +
Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
}
if(!nContext.hasLocals) {
context.hasPureGlobals = true;
}
return n;
});
context.global = resultingGlobal;
newNodes = node.nodes.map(function(n) {
var nContext = {
global: context.global,
lastWasSpacing: true,
hasLocals: false,
explicit: false
};
n = localizeNode(n, nContext);
if(typeof resultingGlobal === 'undefined') {
resultingGlobal = nContext.global;
} else if(resultingGlobal !== nContext.global) {
throw new Error('Inconsistent rule global/local result in rule "' +
Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
}
if(!nContext.hasLocals) {
context.hasPureGlobals = true;
}
return n;
});
context.global = resultingGlobal;
newNodes = node.nodes.map(function(n) {
var nContext = {
global: context.global,
lastWasSpacing: true,
hasLocals: false,
explicit: false
};
n = localizeNode(n, nContext);
if(typeof resultingGlobal === 'undefined') {
resultingGlobal = nContext.global;
} else if(resultingGlobal !== nContext.global) {
throw new Error('Inconsistent rule global/local result in rule "' +
Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
}
if(!nContext.hasLocals) {
context.hasPureGlobals = true;
}
return n;
});
context.global = resultingGlobal;
export function stringifySelector(ast: SelectorAstNode): string {
return tokenizer.stringify(ast)
}
const localizeSelectors = (selectors, mode, getAlias) => {
const node = Tokenizer.parse(selectors);
return Tokenizer.stringify(
Object.assign({}, node, {
nodes: node.nodes.map(n => localizeNode(n, { mode, getAlias })),
})
);
};
const getValue = (messages, name) =>