 cache =
   dependencies: {}
   folders: {}
+  ranges: {}
 
 loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) ->
   nodeModulesPath = path.join(modulePath, 'node_modules')

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

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


  folderPath = path.dirname(parentModule.id)

  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 satisfies(version, range)
      return resolvedPath

  undefined
