 basePath = '/'
 mundlesPath = path.resolve './mundles'
 loadedPlugins = {}
+defaultPackageMain = 'index.js'
 
 # If obj.hasOwnProperty has been overridden, then calling
 # obj.hasOwnProperty(prop) will break.

	if (hasOwnProperty(packageCache, requestPath))
		return callback undefined, packageCache[requestPath]
	jsonPath = path.resolve(requestPath, 'package.json')
	fs.readFile jsonPath, 'utf8', (error, json)->
		if error?
			{errno, code, syscall} = error
			console.error error, 'at readPackage'
			return callback new MundleError {
				message : 'Mundle is missing package.json'
				errno
				code
				syscall
			}
		try
			pkg = packageCache[requestPath] = JSON.parse(json)
		catch e
			e.path = jsonPath
			e.message = 'Error parsing ' + jsonPath + ': ' + e.message
			error = new MundleError e
		callback error, pkg

# check if the file exists and is not a directory
tryFile = (requestPath, callback)->

					if error
						callback error
					else
						unless pkg.main?
							pkg.main = defaultPackageMain
						filename = path.resolve packagePath, pkg.main
						tryFile filename, (error, absPath)->
							unless absPath
								callback new MundleError message : 'need an error message and test!!!'
							else
								gotAbsPath absPath, callback
		else
