 
   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')

  metadata._atomModuleCache = moduleCache
  fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2))

satisfies = (version, rawRange) ->
  unless parsedRange = cache.ranges[rawRange]
    parsedRange = new semver.Range(rawRange)
    cache.ranges[rawRange] = parsedRange
  parsedRange.test(version)

getCachedModulePath = (relativePath, parentModule) ->
  return unless relativePath
  return unless parentModule?.id
