Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
client.get( manifestKey, ( error, manifest ) => {
if ( error ) {
reject( error );
} else if ( manifest && manifest !== 'null' ) {
debug( 'getting manifest from cache' );
resolve( manifest );
} else {
debug( 'building manifest from scratch' );
const doc1 = libxml.parseHtml( html1 );
const doc2 = libxml.parseHtml( html2 );
const themesSupported = config[ 'themes supported' ] || [];
let resources = [];
// href attributes of link elements
resources = resources.concat( _getLinkHrefs( doc1 ) );
resources = resources.concat( _getLinkHrefs( doc2 ) );
// additional themes
resources = resources.concat( _getAdditionalThemes( resources, themesSupported ) );
// translations
resources = resources.concat( _getTranslations( lang ) );
// any resources inside css files
resources = resources.concat( _getResourcesFromCss( resources ) );
client.get( manifestKey, ( error, manifest ) => {
if ( error ) {
reject( error );
} else if ( manifest && manifest !== 'null' ) {
debug( 'getting manifest from cache' );
resolve( manifest );
} else {
debug( 'building manifest from scratch' );
const doc1 = libxml.parseHtml( html1 );
const doc2 = libxml.parseHtml( html2 );
const themesSupported = config[ 'themes supported' ] || [];
let resources = [];
// href attributes of link elements
resources = resources.concat( _getLinkHrefs( doc1 ) );
resources = resources.concat( _getLinkHrefs( doc2 ) );
// additional themes
resources = resources.concat( _getAdditionalThemes( resources, themesSupported ) );
// translations
resources = resources.concat( _getTranslations( lang ) );
// any resources inside css files
resources = resources.concat( _getResourcesFromCss( resources ) );