 fs = Npm.require 'fs'
 
 processFile = (step) ->
-  
+
   # check for extension as filename
   checkFilename step
 

  # extract the source map content from the generated file to give to Meteor
  # explicitly by piping bundle thru `exorcist`
  mapFileName = step.fullInputPath+'.map'
  bundle = bundle.pipe exorcist mapFileName, step.pathForSourceMap

  try # try-catch for browserify errors

    # get browserify result from either the cache or processing
    string = getResult step, bundle, browserifyOptions?.cache

    # read the generated source map from the file
    sourceMap = fs.readFileSync mapFileName, encoding:'utf8'

  bundle.once 'end', -> cb undefined, string  # undefined = error

  # when there's an error, give it to the callback
  # NOTE:
  #  after piping bundle into exorcist transform the once('error') doesn't
  #  work. fixed it by storing original bundle as a property and registering
  #  the event callback on that instead.  
  bundle.originalBundle.once 'error', (error) -> cb error
