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