felixge / node-sandboxed-module

A sandboxed node.js module loader that lets you inject dependencies into your modules.
MIT License
342 stars 42 forks source link

Copy sandbox options when recursing #42

Open OliverJAsh opened 9 years ago

OliverJAsh commented 9 years ago

See https://github.com/felixge/node-sandboxed-module/issues/41.

Given:

var SandboxedModule = require('sandboxed-module');

SandboxedModule.require('./foo', { sourceTransformers: {
    test: function (source) {
        console.log('test source transformer:', this.filename);
        return source;
    }
}});

I would expect that any calls to require inside of the sandboxed module would carry the same options (e.g. sourceTransformers) as the initial sandboxed module.

domenic commented 9 years ago

Can you add a test?