mirror of
https://github.com/jlengrand/open-wc.git
synced 2026-03-10 08:31:19 +00:00
28 lines
558 B
JavaScript
28 lines
558 B
JavaScript
const crypto = require('crypto');
|
|
|
|
function createContentHash(content) {
|
|
return crypto.createHash('md4').update(content).digest('hex');
|
|
}
|
|
|
|
function cleanImportPath(path) {
|
|
if (path.startsWith('/')) {
|
|
return path;
|
|
}
|
|
|
|
if (path.startsWith('../') || path.startsWith('./')) {
|
|
return path;
|
|
}
|
|
|
|
return `./${path}`;
|
|
}
|
|
|
|
function polyfillFilename(polyfill, polyfillsConfig) {
|
|
return `${polyfill.name}${polyfillsConfig.hashPolyfills ? `.${polyfill.hash}` : ''}`;
|
|
}
|
|
|
|
module.exports = {
|
|
createContentHash,
|
|
cleanImportPath,
|
|
polyfillFilename,
|
|
};
|