function applyOutputFileNames (outputOptions, bundle, bundleOutputTypes) {
    let name_map = {};

    bundle.forEach(curr => {
        if (!name_map[curr.name]) {
            name_map[curr.name] = [];
        }

        name_map[curr.name].push(curr);
    });

    Object.keys(name_map).forEach(name => {
        let entries = name_map[name];
        entries.forEach((entry, index) => {
            let name = entry.name + (index > 0? (index + 1) : '');

            if (entry.isEntry && bundleOutputTypes[entry.facadeModuleId] === 'entry') {
                if (outputOptions.file) {
                    entry.fileName = path.basename(outputOptions.file);
                } else {
                    entry.fileName = formatFileName(outputOptions.format, name + '.js', outputOptions.entryFileNames);
                }
            }

            if (entry.isDynamicEntry || bundleOutputTypes[entry.facadeModuleId] === 'chunk') {
                entry.fileName = entry.fileName || formatFileName(outputOptions.format, name + '.js', outputOptions.chunkFileNames);
            }
        });
    });
}
@param {RollupOutputOptions} outputOptions 
@param {RollupOutputFile[]} bundle
@param {Object<string, string>} bundleOutputTypes