Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!injectionTarget.children) {
injectionTarget.children = [];
}
injectionTarget.children = injection.concat(injectionTarget.children);
} else {
// AngularJS??
return source;
}
inlineScripts.forEach((n, i) => {
if (!n.children || n.children.length !== 1) {
console.log(`Weird! Found JS node with the following children: ${JSON.stringify(n.children)}`);
return;
}
n.children[0].data = jsTransform(`${filename}-inline${i}.js`, n.children[0].data);
});
return DomUtils.getOuterHTML(parsedHTML);
}
return fsUtils.read(source).then((fileContents) => {
let dom = getDom(fileContents);
if (scriptElementExists(dom)) { return Promise.resolve(); }
setupIndex(dom);
return fsUtils.write(source, DomUtils.getOuterHTML(dom));
});
};