     return
 
   if typeof component isnt 'string'
-    return callback new Error "Can't provide source for #{name}. Not a file"
+    callback new Error "Can't provide source for #{name}. Not a file"
+    return
 
   fs.readFile component, 'utf-8', (err, code) ->
-    return callback err if err
+    if err
+      callback err
+      return
     callback null,
       name: nameParts[1]
       library: nameParts[0]
       language: utils.guessLanguageFromFilename component
       code: code
+    return
+  return

    fs.writeFile filePath, JSON.stringify(manifest, null, 2),
      encoding: 'utf-8'
    , callback

  readCache: (loader, options, callback) ->
    options.discover = false
    manifest.load.load loader.baseDir, options, callback

  prepareManifestOptions: (loader) ->
    loader.options = {} unless loader.options

    moduleImpl._compile source, modulePath
    implementation = moduleImpl.exports
  catch e
    callback e
    return
  unless typeof implementation is 'function' or typeof implementation.getComponent is 'function'
    callback new Error 'Provided source failed to create a runnable component'
    return

  loader.registerComponent packageId, name, implementation, callback
  return

exports.getSource = (loader, name, callback) ->
  component = loader.components[name]
