lib/prepublish.js
function transformFile ({ config, entry, outdir }) {
  const filename = entry[0]
  const filepath = entry[1] || `${outdir}/${filename}`
  const results = babel.transform(
    fs.readFileSync(filename, 'utf8'),
    Object.assign({}, config, { filename, sourceMaps: true })
  )
  mkdirp.sync(path.dirname(filepath))
  fs.writeFileSync(
    filepath,
    results.code + '\n\n//# sourceMappingURL=' + path.basename(filepath)
  )
  fs.writeFileSync(`${filepath}.map`, JSON.stringify(results.map))

  return results
}
function transformFile ({ config, entry, outdir }) {
  const filename = entry[0]
  const filepath = entry[1] || `${outdir}/${filename}`
  const results = babel.transform(
    fs.readFileSync(filename, 'utf8'),
    Object.assign({}, config, { filename, sourceMaps: true })
  )
  mkdirp.sync(path.dirname(filepath))
  fs.writeFileSync(
    filepath,
    results.code + '\n\n//# sourceMappingURL=' + path.basename(filepath)
  )
  fs.writeFileSync(`${filepath}.map`, JSON.stringify(results.map))

  return results
}
function transformFile ( { config , entry , outdir } ) { const filename = entry [ 0 ] const filepath = entry [ 1 ] || ` ${ outdir } ${ filename } ` const results = babel . transform ( fs . readFileSync ( filename , 'utf8' ) , Object . assign ( { } , config , { filename , sourceMaps : true } ) ) mkdirp . sync ( path . dirname ( filepath ) ) fs . writeFileSync ( filepath , results . code + '\n\n//# sourceMappingURL=' + path . basename ( filepath ) ) fs . writeFileSync ( ` ${ filepath } ` , JSON . stringify ( results . map ) ) return results }
Transform a file with babel and also write the sourcemap for the file.
Transform a file with babel and also write the sourcemap for the file .