Skip to content

Commit

Permalink
stream: reduce internal usage of public require of util
Browse files Browse the repository at this point in the history
PR-URL: nodejs#26698
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BeniCheni authored and targos committed Mar 27, 2019
1 parent 81e1e8a commit 581e1e2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';

const assert = require('internal/assert');
const util = require('util');
const { Socket } = require('net');
const { JSStream } = internalBinding('js_stream');
const uv = internalBinding('uv');
const debug = util.debuglog('stream_socket');
const debug = require('internal/util/debuglog').debuglog('stream_socket');
const { owner_symbol } = require('internal/async_hooks').symbols;
const { ERR_STREAM_WRAP } = require('internal/errors').codes;

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/buffer_list.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { Buffer } = require('buffer');
const { inspect } = require('util');
const { inspect } = require('internal/util/inspect');

function copyBuffer(src, target, offset) {
Buffer.prototype.copy.call(src, target, offset);
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/streams/lazy_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'use strict';

const stream = require('stream');
const util = require('util');

const {
getDefaultEncoding
Expand All @@ -17,7 +16,8 @@ function LazyTransform(options) {
this.writable = true;
this.readable = true;
}
util.inherits(LazyTransform, stream.Transform);
Object.setPrototypeOf(LazyTransform.prototype, stream.Transform.prototype);
Object.setPrototypeOf(LazyTransform, stream.Transform);

function makeGetter(name) {
return function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Stream.Stream = Stream;

// Internal utilities
try {
const types = require('util').types;
const types = require('internal/util/types');
if (types && typeof types.isUint8Array === 'function') {
Stream._isUint8Array = types.isUint8Array;
} else {
Expand Down

0 comments on commit 581e1e2

Please sign in to comment.