Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tags.forEach(oneTag => {
const rootName = oneTag.boundAs || guessRootName(oneTag);
const { content } = oneTag || {};
const code = content ? content.trim() : oneTag || '';
const compiled = code.includes(alreadyCompiledMarker) ? code : compileText(code, rootName);
unregister(rootName);
eval(getRidOfRiotNoise(`${compiled}`)); // eslint-disable-line no-eval
});
const sourceCode = compiler.compile(`${template}`, {});
export default function renderMain({
storyFn,
selectedKind,
selectedStory,
showMain = () => {},
showError = () => {},
}) {
showMain();
unregister('#root');
const rootElement = document.getElementById('root');
rootElement.innerHTML = '';
rootElement.dataset.is = 'root';
const element = storyFn();
const rendered = renderRiot(element);
if (!rendered) {
showError({
title: `Expecting a riot snippet or a riot component from the story: "${selectedStory}" of "${selectedKind}".`,
description: dedent`
Did you forget to return the component snippet from the story?
Use "() => " or when defining the story.
`,
});
}
return rendered;
}