 # Wraps a required module in a define statement.
 wrap = (file) ->
   if Object.keys(file.resolved).length and file.ast
-
     # Update require calls
     map = {}
     for require, filename of file.resolved

        prelude (err, b) ->
          bundle entry, opts, (err, c) ->
            cache = {}
            throw err if err
            callback err, a + b + c


# Bundles up client-side JS, traversing from an initial entry point.
bundle = (entry, opts, callback) ->
  findDependencies entry, (err, requires) ->
    callback err, (wrap require, opts for _, require of requires).join('\n\n')

exports.cli = -> require './cli'

exports.createBundler = ({entry, prepend}) ->
  bundler =
    bundle: (opts, callback) ->
      if typeof opts is 'function'
