return await (async()=>{ const http=require('http'),f=require('fs'),p=require('path'); globalThis.probeRoot=p.join(Editor.Project.path,'build'); globalThis.probeRequests=[];globalThis.probeConsole=[]; globalThis.probeServer=http.createServer((req,res)=>{ let file=p.resolve(globalThis.probeRoot,'.'+decodeURIComponent(new URL(req.url,'http://localhost').pathname)); if(!file.startsWith(globalThis.probeRoot+p.sep)){res.writeHead(403);res.end();return;} if(f.existsSync(file)&&f.statSync(file).isDirectory())file=p.join(file,'index.html'); if(!f.existsSync(file)){res.writeHead(404);res.end();return;} res.setHeader('Content-Type',{'.js':'application/javascript','.json':'application/json','.html':'text/html','.wasm':'application/wasm','.css':'text/css'}[p.extname(file)]||'application/octet-stream'); f.createReadStream(file).pipe(res); }); await new Promise(r=>globalThis.probeServer.listen(8817,'127.0.0.1',r)); const {BrowserWindow}=require('electron'); globalThis.probeWindow=new BrowserWindow({show:false,webPreferences:{backgroundThrottling:false}}); globalThis.probeWindow.webContents.on('console-message',(e,l,m)=>globalThis.probeConsole.push(m)); globalThis.probeWindow.webContents.session.webRequest.onCompleted({urls:['http://127.0.0.1:8817/*']},d=>globalThis.probeRequests.push({url:d.url,status:d.statusCode})); return true; })();