Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const testEs2015 = (noExt + '.es2015.js').toLowerCase();
const matches = files.filter(t => {
const lc = t.toLowerCase();
return lc === testMjs || lc === testEs2015;
});
return matches.length > 0;
}
// Note: empty string value is equivalent to a bare attribute, according to
// https://github.com/inikulin/parse5/issues/1
const nomodule = hasMatchingModule(s, jsFiles) ? [{name: 'nomodule', value: ''}] : [];
const noModuleScript = treeAdapter.createElement('script', undefined, nomodule.concat([
{name: 'src', value: `/${relative(s)}?v=${timestamp()}`},
]));
treeAdapter.appendChild(body, noModuleScript);
}
}
for (const s of params.filter(s => /\.css$/.test(s))) {
const stylesheet = treeAdapter.createElement('link', undefined, [
{name: 'rel', value: 'stylesheet'},
{name: 'href', value: `/${relative(s)}?v=${timestamp()}`},
]);
treeAdapter.appendChild(head, stylesheet);
}
const content = parse5.serialize(document, {treeAdapter});
write(outputFile, content, {encoding: 'utf-8'});
return 0;
}
// https://github.com/inikulin/parse5/issues/1
const nomodule = hasMatchingModule(s, jsFiles) ? [{name: 'nomodule', value: ''}] : [];
const noModuleScript = treeAdapter.createElement('script', undefined, nomodule.concat([
{name: 'src', value: `/${relative(s)}?v=${timestamp()}`},
]));
treeAdapter.appendChild(body, noModuleScript);
}
}
for (const s of params.filter(s => /\.css$/.test(s))) {
const stylesheet = treeAdapter.createElement('link', undefined, [
{name: 'rel', value: 'stylesheet'},
{name: 'href', value: `/${relative(s)}?v=${timestamp()}`},
]);
treeAdapter.appendChild(head, stylesheet);
}
const content = parse5.serialize(document, {treeAdapter});
write(outputFile, content, {encoding: 'utf-8'});
return 0;
}
return execPath;
}
const jsFiles = params.filter(s => /\.m?js$/i.test(s));
for (const s of jsFiles) {
// Differential loading: for filenames like
// foo.mjs
// bar.es2015.js
// we use a