File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class FastBoot {
4747 this . resilient = 'resilient' in options ? Boolean ( options . resilient ) : false ;
4848
4949 this . distPath = distPath ;
50- this . sandbox = sandbox || require ( './vm- sandbox' ) ;
50+ this . sandbox = sandbox || require ( './sandbox' ) ;
5151 this . sandboxGlobals = sandboxGlobals || { } ;
5252
5353 this . _buildEmberApp ( this . distPath , this . sandbox , this . sandboxGlobals ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
33const chalk = require ( 'chalk' ) ;
4+ const vm = require ( 'vm' ) ;
45
5- class Sandbox {
6+ module . exports = class Sandbox {
67 constructor ( options = { } ) {
78 this . globals = options . globals ;
89 this . sandbox = this . buildSandbox ( ) ;
10+ vm . createContext ( this . sandbox ) ;
911 }
1012
1113 buildSandbox ( ) {
@@ -48,6 +50,13 @@ class Sandbox {
4850
4951 return wrappedConsole ;
5052 }
51- }
5253
53- module . exports = Sandbox ;
54+ eval ( source , filePath ) {
55+ var fileScript = new vm . Script ( source , { filename : filePath } ) ;
56+ fileScript . runInContext ( this . sandbox ) ;
57+ }
58+
59+ run ( cb ) {
60+ return cb . call ( this . sandbox , this . sandbox ) ;
61+ }
62+ } ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments