function normalizedPackageFilename(filename, dirs) {
    const WINDOWS_PATH_SEPARATORS = /\\/g;

    const patternTemplate = /((.*(node_modules|bower_components))|__DIRS__)\//g;
    const vendoredPath = new RegExp(
        patternTemplate.source.replace('__DIRS__', dirs.join('|')),
        'g'
    );

    return filename.replace(WINDOWS_PATH_SEPARATORS, '/').replace(vendoredPath, '');
}
@param {string} filename
@param {string[]} dirs