@foal/graphiql 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GraphiQLController = void 0;
13
13
  // std
14
14
  const fs_1 = require("fs");
15
+ const promises_1 = require("node:fs/promises");
15
16
  const path_1 = require("path");
16
- const util_1 = require("util");
17
17
  // 3p
18
18
  const core_1 = require("@foal/core");
19
19
  /**
@@ -31,7 +31,7 @@ class GraphiQLController {
31
31
  if (!ctx.request.path.endsWith('/')) {
32
32
  return new core_1.HttpResponseMovedPermanently(ctx.request.path + '/');
33
33
  }
34
- const template = await (0, util_1.promisify)(fs_1.readFile)((0, path_1.join)(__dirname, 'templates/index.html'), 'utf8');
34
+ const template = await (0, promises_1.readFile)((0, path_1.join)(__dirname, 'templates/index.html'), 'utf8');
35
35
  const page = (0, core_1.renderToString)(template, {
36
36
  options: JSON.stringify(this.options),
37
37
  endpoint: this.apiEndpoint,
@@ -54,7 +54,7 @@ class GraphiQLController {
54
54
  async createHttpResponseFile(filename, contentType) {
55
55
  const filePath = (0, path_1.join)(__dirname, 'static', filename);
56
56
  const stream = (0, fs_1.createReadStream)(filePath);
57
- const stats = await (0, util_1.promisify)(fs_1.stat)(filePath);
57
+ const stats = await (0, promises_1.stat)(filePath);
58
58
  return new core_1.HttpResponseOK(stream, { stream: true })
59
59
  .setHeader('Content-Type', contentType)
60
60
  .setHeader('Content-Length', stats.size.toString());