File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 4
4
// of a sample application to be executed in the sandboxed context by
5
5
// another pice of code from `framework.js`. Read README.md for tasks.
6
6
7
- const fs = require ( 'fs' ) ;
8
- const net = require ( 'net' ) ;
7
+ const fs = require ( 'node: fs' ) ;
8
+ const net = require ( 'node: net' ) ;
9
9
10
10
// Print from the global context of application module
11
11
console . log ( 'From application global context' ) ;
Original file line number Diff line number Diff line change @@ -8,17 +8,17 @@ const PARSING_TIMEOUT = 1000;
8
8
const EXECUTION_TIMEOUT = 5000 ;
9
9
10
10
// The framework can require core libraries
11
- const fs = require ( 'fs' ) ;
12
- const vm = require ( 'vm' ) ;
13
- const timers = require ( 'timers' ) ;
14
- const events = require ( 'events' ) ;
11
+ const fs = require ( 'node: fs' ) ;
12
+ const vm = require ( 'node: vm' ) ;
13
+ const timers = require ( 'node: timers' ) ;
14
+ const events = require ( 'node: events' ) ;
15
15
16
16
// Create a hash and turn it into the sandboxed context which will be
17
17
// the global context of an application
18
18
const context = {
19
19
module : { } , console,
20
20
require : ( name ) => {
21
- if ( name === 'fs' ) {
21
+ if ( name === 'fs' || name === 'node:fs' ) {
22
22
console . log ( 'Module fs is restricted' ) ;
23
23
return null ;
24
24
}
You can’t perform that action at this time.
0 commit comments