Lines 130-170javascript
130 // Create a context with require and other Node.js globals available
131 const evalContext = {
133 module: { exports: {} },
135 __dirname: process.cwd(),
136 __filename: import.meta.url,
140 Buffer: typeof Buffer !== 'undefined' ? Buffer : undefined,
141 setTimeout: setTimeout,
142 setInterval: setInterval,
143 clearTimeout: clearTimeout,
144 clearInterval: clearInterval,
146 async: async function(fn) { return fn; }
149 // Use Function constructor to create an eval with the context
150 // Note: The code uses async/await, so we need to handle that
151 const evalFn = new Function(
152 'require', 'module', 'exports', '__dirname', '__filename', 'console', 'process', 'global', 'Buffer', 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval', 'Promise',
157 const result = evalFn(
161 evalContext.__dirname,
162 evalContext.__filename,
167 evalContext.setTimeout,
168 evalContext.setInterval,
169 evalContext.clearTimeout,
170 evalContext.clearInterval,