Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parse(code: string): STStyle[] {
return [transformStyle(_parse(code), code, 0)]
}
function getAst(code: string) {
const root = parse(code)
return transformStyle(root, code, 0)
}
function getAst(code: string): STStyle {
const root = parse(code)
return transformStyle(root, code, 0)
}
generateStyleObject(executionContext) {
const flatStyles = flatten(this.rules, executionContext).join('');
const hash = createHash(flatStyles);
if (!generated[hash]) {
const rules = [];
parse(flatStyles).each(node => {
switch (node.type) {
case 'decl':
rules.push([node.prop, node.value]);
return;
case 'comment':
return;
default:
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Node of type ${node.type} not supported as an inline style`,
);
}
}
});
const styles = cssToStyle(rules);
const instance = stylesheet.create({ generated: styles });
cssProperty(node.prop, node.value, cssVariables, node.important) +
";";
break;
}
default: {
throw Error(
`MetaTemplate: Unrecognised CSS node type "${
node.type
}". Please contribute your CSS as a test case to the project.`
);
}
}
return response;
};
const cssNodes = [...cssParser(cssString).nodes];
return cssNodes.map(node => renderCSS(node)).join("\n");
};
.map(node => node.trim())
.join(";\n") + ";\n";
}
if (isDynamic) {
css += "`}\n";
}
if (isWrapped) {
css += "}\n";
}
return css.trim();
};
const cssNodes = [...cssParser(cssString).nodes];
let css = cssNodes.map(node => renderCSS(node)).join("\n");
return {
scBody: css,
usedProps: uniq(usedProps)
};
};
const styleAsts = styles.map((s, i) => {
return transformStyle(postcssParse(s.content), s.content, i)
})