mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Add initial cache of resource path module
This commit is contained in:
committed by
Kevin Sawicki
parent
1154490a97
commit
4da6513fb5
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user