Skip to content

Commit 13ed127

Browse files
committed
Gently tidy up Node imports & avoid Buffer global
1 parent ea2e2bb commit 13ed127

34 files changed

+96
-48
lines changed

src/admin/admin-plugin-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Duplex } from "stream";
1+
import { Duplex } from 'stream';
22
import { DocumentNode } from "graphql";
33
import { IResolvers } from "@graphql-tools/utils";
44
import { MaybePromise } from "@httptoolkit/util";

src/admin/admin-server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { Buffer } from 'buffer';
2+
import * as http from 'http';
3+
import * as net from 'net';
4+
15
import * as _ from 'lodash';
26
import * as express from 'express';
37
import * as cors from 'cors';
48
import corsGate = require('cors-gate');
5-
import * as http from 'http';
6-
import * as net from 'net';
79
import * as bodyParser from 'body-parser';
810
import * as Ws from 'ws';
911
import { v4 as uuid } from "uuid";

src/admin/mockttp-admin-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as _ from "lodash";
2-
import { Duplex } from "stream";
2+
import { Duplex } from 'stream';
33

44
import { PubSub } from "graphql-subscriptions";
55
import type { IResolvers } from "@graphql-tools/utils";

src/client/mockttp-admin-request-builder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import _ = require('lodash');
1+
import { Buffer } from 'buffer';
22
import * as stream from 'stream';
3+
4+
import _ = require('lodash');
35
import gql from 'graphql-tag';
46

57
import { MockedEndpoint, MockedEndpointData } from "../types";

src/rules/matchers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import * as _ from 'lodash';
1+
import { Buffer } from 'buffer';
22
import * as url from 'url';
3+
4+
import * as _ from 'lodash';
35
import { oneLine } from 'common-tags';
46
import * as multipart from 'parse-multipart-data';
57
import { MaybePromise } from '@httptoolkit/util';

src/rules/passthrough-handling.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import * as _ from 'lodash';
1+
import { Buffer } from 'buffer';
22
import * as fs from 'fs/promises';
33
import * as tls from 'tls';
4-
import url = require('url');
4+
import * as url from 'url';
5+
6+
import * as _ from 'lodash';
57
import { oneLine } from 'common-tags';
68
import CacheableLookup from 'cacheable-lookup';
79
import * as semver from 'semver';

src/rules/requests/request-rule-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { merge, isString, isBuffer } from "lodash";
2-
import { Readable } from "stream";
2+
import { Readable } from 'stream';
33
import * as url from 'url';
44
import { MaybePromise } from '@httptoolkit/util';
55

src/rules/requests/request-rule.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Buffer } from 'buffer';
2+
13
import * as _ from 'lodash';
24
import { v4 as uuid } from "uuid";
35

src/rules/requests/request-step-impls.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import _ = require('lodash');
2-
import url = require('url');
1+
import { Buffer } from 'buffer';
32
import type dns = require('dns');
3+
import url = require('url');
44
import net = require('net');
5-
import tls = require('tls');
65
import http = require('http');
76
import https = require('https');
7+
8+
import * as _ from 'lodash';
89
import * as fs from 'fs/promises';
910
import * as h2Client from 'http2-wrapper';
1011
import { decode as decodeBase64 } from 'base64-arraybuffer';

src/rules/rule-deserialization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Duplex } from "stream";
1+
import { Duplex } from 'stream';
22

33
import { Serialized, SerializedValue, deserialize } from "../serialization/serialization";
44

0 commit comments

Comments
 (0)