Add initial cache of resource path module

This commit is contained in:
Kevin Sawicki
2014-10-07 14:29:24 -07:00
committed by Kevin Sawicki
parent 1154490a97
commit 4da6513fb5
2 changed files with 19 additions and 1 deletions

View File

@@ -95,3 +95,18 @@ exports.register = ->
resolvedPath = getCachedModulePath(relativePath, parentModule)
resolvedPath ? originalResolveFilename(relativePath, parentModule)
registered = true
dependencies = {}
folders = {}
global.mc = {dependencies, folders}
exports.add = (directoryPath) ->
cache = require(path.join(directoryPath, 'package.json'))?._atomModuleCache
for dependency in cache?.dependencies ? []
dependencies[dependency.name] ?= {}
dependencies[dependency.name][dependency.version] = path.join(directoryPath, dependency.path)
for entry in cache?.folders ? []
for folderPath in entry.paths
folders[path.join(directoryPath, folderPath)] = entry.dependencies

View File

@@ -1,7 +1,10 @@
# Like sands through the hourglass, so are the days of our lives.
startTime = Date.now()
require('./module-cache').register()
ModuleCache = require('./module-cache')
ModuleCache.add(JSON.parse(decodeURIComponent(location.search.substr(14))).resourcePath)
ModuleCache.register()
require './window'
Atom = require './atom'