|
@ -69,18 +69,13 @@ var module = (function () { |
|
|
var Script; |
|
|
var Script; |
|
|
|
|
|
|
|
|
var internalModuleCache = {}; |
|
|
var internalModuleCache = {}; |
|
|
|
|
|
var moduleCache = {}; |
|
|
|
|
|
|
|
|
function Module (id, parent) { |
|
|
function Module (id, parent) { |
|
|
this.id = id; |
|
|
this.id = id; |
|
|
this.exports = {}; |
|
|
this.exports = {}; |
|
|
this.parent = parent; |
|
|
this.parent = parent; |
|
|
|
|
|
|
|
|
if (parent) { |
|
|
|
|
|
this.moduleCache = parent.moduleCache; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.moduleCache = {}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.filename = null; |
|
|
this.filename = null; |
|
|
this.loaded = false; |
|
|
this.loaded = false; |
|
|
this.exited = false; |
|
|
this.exited = false; |
|
@ -234,11 +229,11 @@ var module = (function () { |
|
|
throw new Error("Cannot find module '" + request + "'"); |
|
|
throw new Error("Cannot find module '" + request + "'"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var cachedModule = parent.moduleCache[filename]; |
|
|
var cachedModule = moduleCache[filename]; |
|
|
if (cachedModule) return cachedModule.exports; |
|
|
if (cachedModule) return cachedModule.exports; |
|
|
|
|
|
|
|
|
var module = new Module(id, parent); |
|
|
var module = new Module(id, parent); |
|
|
module.moduleCache[filename] = module; |
|
|
moduleCache[filename] = module; |
|
|
module.load(filename); |
|
|
module.load(filename); |
|
|
return module.exports; |
|
|
return module.exports; |
|
|
}; |
|
|
}; |
|
|