       console.error "File not found: #{source}"
       process.exit 1
     throw err
-  if stats.isDirectory() and path.dirname(source) isnt 'node_modules'
+  if stats.isDirectory()
+    if path.basename(source) is 'node_modules'
+      notSources[source] = yes
+      return
     watchDir source, base if opts.watch
     try
       files = fs.readdirSync source
     catch err
       if err.code is 'ENOENT' then return else throw err
-    index = sources.indexOf source
-    files = files.filter (file) -> not hidden file
-    sources[index..index] = (path.join source, file for file in files)
-    sourceCode[index..index] = files.map -> null
-    files.forEach (file) ->
+    for file in files
       compilePath (path.join source, file), no, base
   else if topLevel or helpers.isCoffee source
+    sources.push source
+    sourceCode.push null
+    delete notSources[source]
     watch source, base if opts.watch
     try
       code = fs.readFileSync source

  return version()                              if opts.version
  return require('./repl').start(replCliOpts)   if opts.interactive
  return compileStdio()                         if opts.stdio
  return compileScript null, sources[0]         if opts.eval
  return require('./repl').start(replCliOpts)   unless sources.length
  literals = if opts.run then sources.splice 1 else []
  process.argv = process.argv[0..1].concat literals
  process.argv[0] = 'coffee'

  opts.output = path.resolve opts.output  if opts.output
  opts.join   = path.resolve opts.join    if opts.join
  for source in sources
    source = path.resolve source
    compilePath source, yes, source


    compileScript(source, code.toString(), base)
  else
    notSources[source] = yes

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