Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Add 'root' global variable as reference to sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jul 15, 2010
1 parent 5f30377 commit 3a00470
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/module.js
Expand Up @@ -400,6 +400,7 @@ Module.prototype._compile = function (content, filename) {
sandbox.__filename = filename;
sandbox.__dirname = dirname;
sandbox.module = self;
sandbox.root = sandbox;

Script.runInNewContext(content, sandbox, filename);

Expand All @@ -411,6 +412,7 @@ Module.prototype._compile = function (content, filename) {
global.__filename = filename;
global.__dirname = dirname;
global.module = self;
global.root = global;
Script.runInThisContext(content, filename);
}

Expand Down

0 comments on commit 3a00470

Please sign in to comment.