lib/utils/sourceMap.js
function create(content, url) {
  url = url || '<source>';
  const map = new SourceMapGenerator({ file: url });
  const lines = content.split('\n');

  for (let l = 1, n = lines.length; l <= n; l++) {
    // Skip empty
    if (lines[l - 1]) {
      map.addMapping({
        source: url,
        original: { line: l, column: 0 },
        generated: { line: l, column: 0 }
      });
    }
  }

  map.setSourceContent(url, content);
  return map;
}
function create(content, url) {
  url = url || '<source>';
  const map = new SourceMapGenerator({ file: url });
  const lines = content.split('\n');

  for (let l = 1, n = lines.length; l <= n; l++) {
    // Skip empty
    if (lines[l - 1]) {
      map.addMapping({
        source: url,
        original: { line: l, column: 0 },
        generated: { line: l, column: 0 }
      });
    }
  }

  map.setSourceContent(url, content);
  return map;
}
function create ( content , url ) { url = url || '<source>' ; const map = new SourceMapGenerator ( { file : url } ) ; const lines = content . split ( '\n' ) ; for ( let l = 1 , n = lines . length ; l <= n ; l ++ ) { // Skip empty if ( lines [ l - 1 ] ) { map . addMapping ( { source : url , original : { line : l , column : 0 } , generated : { line : l , column : 0 } } ) ; } } map . setSourceContent ( url , content ) ; return map ; }
Create source map from 'content'
@param {String} content
@param {String} [url]
@returns {SourceMapGenerator}
Create source map from content