 	exports.rebuildPackageCache() unless packageCache?
 	
 	results = {}
-	
-	invokeRecursive = (path, parent) ->
-		
-		for key, objectOrFunction of parent
-			
-			if key.charCodeAt(0) is '$'.charCodeAt(0)
-	
-				if key is "$#{hook}"
-					
-					results[path] = objectOrFunction args...
-					
-			else
-				
-				invokeRecursive "#{path}/#{key}", objectOrFunction
-				
-	invokeRecursive name, package_ for name, package_ of packageCache
-	
+	results[path] = fn args... for {path, fn} in packageCache[hook] ? []
 	results

_packages = []

exports.rebuildPackageCache = ->
	packageCache = {}
	
	for name in _packages

				
			throw error
			
		moduleCache[name] = package_
		
	cacheRecursive = (path, parent) ->
		
		for key, objectOrFunction of parent
			
			if key.charCodeAt(0) is '$'.charCodeAt(0)
				
				(packageCache[key.slice 1] ?= []).push
					path: path
					fn: objectOrFunction
	
			else
				
				cacheRecursive "#{path}/#{key}", objectOrFunction
				
	cacheRecursive path, module for path, module of moduleCache
		
	return

