function generateSourceMap (mapChain, mapGenerator, original_code, filepath) {
    let map;

    if (mapChain.length > 1) {
        // @ts-ignore
        map = mapGenerator.toJSON();
    } else {
        map = mapChain.length > 0? mapChain[0].map : undefined;
    }

    if (map) {
        map.file = filepath;
        map.sources = [filepath];
        map.sourcesContent = [original_code];
    }

    // @ts-ignore
    return map;
}
@param {NollupTransformMapEntry[]} mapChain 
@param {SourceMapGenerator} mapGenerator 
@param {string} original_code 
@param {string} filepath 
@return {RollupSourceMap}