'use babel'

export const compiler = false
export const minifier = true

let uglify = null

export function process(contents, _, {config, state}) {
  if (uglify === null) {
    uglify = require('uglify-js')
  }
  const options = Object.assign({
    fromString: true,
    outSourceMap: 'processed.map'
  }, config.uglify)
  const processed = uglify.minify(contents, options)
  state.sourceMap = processed.map
  return processed.code.slice(0, -34)
}

@@ -6,16 +6,46 @@
 babel'%0A%0A
+import %7Bdirname%7D from 'path'%0A%0A
 export c
@@ -153,9 +153,32 @@
 ts, 
-_
+%7BfileName, absolutePath%7D
 , %7Bc
@@ -332,29 +332,25 @@
 ceMap: '
-processed.map
+something
 '%0A  %7D, c
@@ -436,16 +436,27 @@
 ceMap = 
+JSON.parse(
 processe
@@ -460,16 +460,270 @@
 ssed.map
+)%0A  state.sourceMap = %7B%0A    version: state.sourceMap.version,%0A    sources: %5BfileName%5D,%0A    file: fileName,%0A    mappings: state.sourceMap.mappings,%0A    names: state.sourceMap.names,%0A    sourceRoot: dirname(absolutePath),%0A    sourcesContent: %5Bcontents%5D%0A  %7D
 %0A  retur
@@ -754,9 +754,9 @@
 , -3
-4
+0
 )%0A%7D%0A

Implement source map support