Instead of removing things from Narwhal (which you might find useful
for setting up some capabilities for your users, you might consider
using the "sandbox" module to create a new, attenuated module system.
Instead of providing a loader, provide a modules hash with the
capabilities you want the user to be able to load. You can also
create an attenuated loader if you want users to have limited access
to their own modules.
Bear with me since I haven't used this in a while:
var SB = require("narwhal/sandbox");
var sb = SB.Sandbox({
"modules": {…},
"loader": require.loader // or something with limited loading powers
});
Narwhal is pretty flexible about instantiating new module systems with
limited or injected capabilities.
Kris Kowal