node-stdlib-browser
Version:
Node standard library for browser.
35 lines (31 loc) • 758 B
JavaScript
;
/**
* @typedef {import('rollup')} rollup
* @typedef {import('rollup').WarningHandlerWithDefault} rollup.WarningHandlerWithDefault
*/
/**
* @type {rollup.WarningHandlerWithDefault}
*/
function handleCircularDependancyWarning(warning, warningHandler) {
const packagesWithCircularDependencies = [
'util/',
'assert/',
'readable-stream/',
'crypto-browserify/'
];
if (
!(
warning.code === 'CIRCULAR_DEPENDENCY' &&
packagesWithCircularDependencies.some((modulePath) => {
if (typeof warning.importer !== 'string') {
return false;
}
return warning.importer.includes(modulePath);
})
)
) {
warningHandler(warning);
}
}
module.exports.handleCircularDependancyWarning =
handleCircularDependancyWarning;