     jsPath = outputPath source, base
     path.exists jsPath, (exists) ->
       if exists
-        fs.unlink jsPath, (err) -> 
+        fs.unlink jsPath, (err) ->
           throw err if err
           timeLog "removed #{source}"
-        
+
 # Get the corresponding output JavaScript path for a source file.
 outputPath = (source, base) ->
   filename  = path.basename(source, path.extname(source)) + '.js'

  process.execPath = require.main.filename
  for source in sources
    compilePath source, yes, path.normalize source
    
# Compile a path, which could be a script or a directory. If a directory 
# is passed, recursively compile all '.coffee' extension source files in it 
# and all subdirectories.
compilePath = (source, topLevel, base) ->
  path.exists source, (exists) ->
    if topLevel and not exists and source[-7..] isnt '.coffee'
      source = sources[sources.indexOf(source)] = "#{source}.coffee"
      return compilePath source, topLevel, base
    if topLevel and not exists 
      console.error "File not found: #{source}"
      process.exit 1
    fs.stat source, (err, stats) ->
      throw err if err
      if stats.isDirectory()
        watchDir source, base if opts.watch
        fs.readdir source, (err, files) ->
          throw err if err
          files = files.map (file) -> path.join source, file
          index = sources.indexOf source
          sources[index..index] = files
          sourceCode[index..index] = files.map -> null
          compilePath file, no, base for file in files
      else if topLevel or path.extname(source) is '.coffee'
        watch source, base if opts.watch
        fs.readFile source, (err, code) ->
          throw err if err
          compileScript(source, code.toString(), base)
      else
        notSources[source] = yes
        removeSource source, base
            

# Compile a single source script, containing the given code, according to the
# requested options. If evaluating the script directly sets `__filename`,

        timeLog "compiled #{source}"
  path.exists jsDir, (exists) ->
    if exists then compile() else exec "mkdir -p #{jsDir}", compile

# When watching scripts, it's useful to log changes with the timestamp.
timeLog = (message) ->
  console.log "#{(new Date).toLocaleTimeString()} - #{message}"
