defineReadOnlyProperty(moduleObject, "require", this);
if(!sandboxed) {
defineReadOnlyProperty(moduleObject, "uri", uri.toString());
}
final Scriptable executionScope = new ModuleScope(nativeScope, uri, base);
// Set this so it can access the global JS environment objects.
// This means we're currently using the "MGN" approach (ModuleScript
// with Global Natives) as specified here:
// <http://wiki.commonjs.org/wiki/Modules/ProposalForNativeExtension>
executionScope.put("exports", executionScope, exports);
executionScope.put("module", executionScope, moduleObject);
moduleObject.put("exports", moduleObject, exports);
install(executionScope);
if(isMain) {
defineReadOnlyProperty(this, "main", moduleObject);
}