Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • utils/jsffi/dyld.mjs
    ... ... @@ -291,7 +291,7 @@ const isNode = Boolean(globalThis?.process?.versions?.node);
    291 291
     // factor out browser-only/node-only logic into different modules. For
    
    292 292
     // now, just make these global let bindings optionally initialized if
    
    293 293
     // isNode and be careful to not use them in browser-only logic.
    
    294
    -let fs, http, path, require, stream, util, wasi, ws, zlib;
    
    294
    +let fs, http, path, require, stream, wasi, ws;
    
    295 295
     
    
    296 296
     if (isNode) {
    
    297 297
       require = (await import("node:module")).createRequire(import.meta.url);
    
    ... ... @@ -300,9 +300,7 @@ if (isNode) {
    300 300
       http = require("http");
    
    301 301
       path = require("path");
    
    302 302
       stream = require("stream");
    
    303
    -  util = require("util");
    
    304 303
       wasi = require("wasi");
    
    305
    -  zlib = require("zlib");
    
    306 304
     
    
    307 305
       // Optional npm dependencies loaded via NODE_PATH
    
    308 306
       try {
    
    ... ... @@ -561,30 +559,8 @@ args.rpc.opened.then(() => main(args));
    561 559
               }[path.extname(p)] || "application/octet-stream"
    
    562 560
             );
    
    563 561
     
    
    564
    -        const buf = Buffer.from(await fs.promises.readFile(p));
    
    565
    -        const etag = `sha512-${Buffer.from(
    
    566
    -          await crypto.subtle.digest("SHA-512", buf)
    
    567
    -        ).toString("base64")}`;
    
    568
    -
    
    569
    -        res.setHeader("ETag", etag);
    
    570
    -
    
    571
    -        if (req.headers["if-none-match"] === etag) {
    
    572
    -          res.writeHead(304);
    
    573
    -          res.end();
    
    574
    -          return;
    
    575
    -        }
    
    576
    -
    
    577
    -        res.setHeader("Content-Encoding", "br");
    
    578
    -
    
    579 562
             res.writeHead(200);
    
    580
    -        res.end(
    
    581
    -          await util.promisify(zlib.brotliCompress)(buf, {
    
    582
    -            params: {
    
    583
    -              [zlib.constants.BROTLI_PARAM_QUALITY]:
    
    584
    -                zlib.constants.BROTLI_MIN_QUALITY,
    
    585
    -            },
    
    586
    -          })
    
    587
    -        );
    
    563
    +        fs.createReadStream(p).pipe(res);
    
    588 564
             return;
    
    589 565
           }
    
    590 566