Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(i => {
const squeezed = i.value.replace(/\s+/g, ' ').split(' import').join('\nimport')
const parsed = parseImports(squeezed)
return {
raw: i.value,
parsed
}
})
const scope = importScope(imports)
return {
imports,
scope,
blocks: blocks.concat(scope)
}
}
function smartHtmlParser(componentWhitelist) {
var components = blockElements.concat(componentWhitelist).join('|');
function parseOpeningTags(valueDesc) {
return partialTokenizer(function (valueDesc) {
var regexp = '<(' + components + ')(' + attribute + '*)\\s*(/?)>';
var propertiesRegex = '(' + attributeName + ')(?:\\s*=\\s*' + attributeValue + ')?';
var matches = getAllMatches(regexp, valueDesc.value).map(function (match) {
return {
value: match[0],
type: match[8] ? 'autoCloseTag' : 'openTag',
tagName: match[1],
startsAt: match.index + valueDesc.startsAt,
endsAt: valueDesc.startsAt + match.index + match[0].length,
properties: getAllMatches(propertiesRegex, match[2]).reduce(function (props, m) {
var value = m[2] || m[3] || m[5];
var quote = m[4] || m[6];
var unescapedValue = quote ? value.replace(new RegExp('\\\\' + quote, 'g'), quote) : value;