 
   folderPath = path.dirname(parentModule.id)
 
-  dependency = cache.folders[folderPath]?[relativePath]
-  return unless dependency?
+  range = cache.folders[folderPath]?[relativePath]
+  return unless range?
 
   candidates = cache.dependencies[relativePath]
   return unless candidates?
 
   for version, resolvedPath of candidates
-    if Module._cache[resolvedPath] and semver.satisfies(version, dependency)
+    if Module._cache[resolvedPath] and satisfies(version, range)
       return resolvedPath
 
   undefined

cache =
  dependencies: {}
  folders: {}

loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) ->
  nodeModulesPath = path.join(modulePath, 'node_modules')


  nodeModulesPath = path.join(modulePath, 'node_modules')
  dependencies = JSON.parse(fs.readFileSync(metadataPath))?.dependencies ? {}

  for name, version of dependencies
    try
      new semver.Range(version)
    catch error
      invalidVersion = version
      version = JSON.parse(fs.readFileSync(path.join(nodeModulesPath, name, 'package.json')))?.version
      dependencies[name] = version
      console.log "Normalized #{name}: #{invalidVersion} -> #{version}"

  onDirectory = (childPath) ->
    path.basename(childPath) isnt 'node_modules'
