   iterate = (require, parent) ->
     if parent and /^[./]/.test require
       # this is a relative require
-      path = join parent.base, require
+      requirePath = join parent.base, require
     else
       # this is an npm module
-      path = require
+      requirePath = require
 
-    resolve path, (err, filename) ->
+    resolve requirePath, (err, filename) ->
       if parent
         # Add to parent's map of resolved modules
         parent.resolved[require] = filename


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

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

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

# 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
