lib: consolidate redundant require() calls
PR-URL: https://github.com/nodejs/node/pull/21699 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
parent
d0b00a79d4
commit
573744caae
@ -25,12 +25,11 @@ const assert = require('assert').ok;
|
|||||||
const Stream = require('stream');
|
const Stream = require('stream');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const internalUtil = require('internal/util');
|
const internalUtil = require('internal/util');
|
||||||
const internalHttp = require('internal/http');
|
const { outHeadersKey, utcDate } = require('internal/http');
|
||||||
const { Buffer } = require('buffer');
|
const { Buffer } = require('buffer');
|
||||||
const common = require('_http_common');
|
const common = require('_http_common');
|
||||||
const checkIsHttpToken = common._checkIsHttpToken;
|
const checkIsHttpToken = common._checkIsHttpToken;
|
||||||
const checkInvalidHeaderChar = common._checkInvalidHeaderChar;
|
const checkInvalidHeaderChar = common._checkInvalidHeaderChar;
|
||||||
const { outHeadersKey } = require('internal/http');
|
|
||||||
const {
|
const {
|
||||||
defaultTriggerAsyncIdScope,
|
defaultTriggerAsyncIdScope,
|
||||||
symbols: { async_id_symbol }
|
symbols: { async_id_symbol }
|
||||||
@ -48,7 +47,6 @@ const {
|
|||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
|
|
||||||
const { CRLF, debug } = common;
|
const { CRLF, debug } = common;
|
||||||
const { utcDate } = internalHttp;
|
|
||||||
|
|
||||||
const kIsCorked = Symbol('isCorked');
|
const kIsCorked = Symbol('isCorked');
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { AsyncWrap, Providers } = process.binding('async_wrap');
|
const { AsyncWrap, Providers } = process.binding('async_wrap');
|
||||||
const { Buffer } = require('buffer');
|
const { Buffer, kMaxLength } = require('buffer');
|
||||||
const { randomBytes: _randomBytes } = process.binding('crypto');
|
const { randomBytes: _randomBytes } = process.binding('crypto');
|
||||||
const {
|
const {
|
||||||
ERR_INVALID_ARG_TYPE,
|
ERR_INVALID_ARG_TYPE,
|
||||||
@ -10,7 +10,6 @@ const {
|
|||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
const { isArrayBufferView } = require('internal/util/types');
|
const { isArrayBufferView } = require('internal/util/types');
|
||||||
|
|
||||||
const { kMaxLength } = require('buffer');
|
|
||||||
const kMaxUint32 = 2 ** 32 - 1;
|
const kMaxUint32 = 2 ** 32 - 1;
|
||||||
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
|
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
/* eslint-disable no-use-before-define */
|
/* eslint-disable no-use-before-define */
|
||||||
|
|
||||||
require('internal/util').assertCrypto();
|
const internalUtil = require('internal/util');
|
||||||
|
internalUtil.assertCrypto();
|
||||||
|
|
||||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
const { async_id_symbol } = require('internal/async_hooks').symbols;
|
const { async_id_symbol } = require('internal/async_hooks').symbols;
|
||||||
@ -71,7 +72,7 @@ const { utcDate } = require('internal/http');
|
|||||||
const {
|
const {
|
||||||
promisify,
|
promisify,
|
||||||
customInspectSymbol: kInspect
|
customInspectSymbol: kInspect
|
||||||
} = require('internal/util');
|
} = internalUtil;
|
||||||
const { isArrayBufferView } = require('internal/util/types');
|
const { isArrayBufferView } = require('internal/util/types');
|
||||||
const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
|
const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
|
||||||
const { _connectionListener: httpConnectionListener } = http;
|
const { _connectionListener: httpConnectionListener } = http;
|
||||||
|
@ -14,8 +14,9 @@ const fs = require('fs');
|
|||||||
const { _makeLong } = require('path');
|
const { _makeLong } = require('path');
|
||||||
const { SafeMap } = require('internal/safe_globals');
|
const { SafeMap } = require('internal/safe_globals');
|
||||||
const { URL } = require('url');
|
const { URL } = require('url');
|
||||||
const debug = require('util').debuglog('esm');
|
const util = require('util');
|
||||||
const readFileAsync = require('util').promisify(fs.readFile);
|
const debug = util.debuglog('esm');
|
||||||
|
const readFileAsync = util.promisify(fs.readFile);
|
||||||
const readFileSync = fs.readFileSync;
|
const readFileSync = fs.readFileSync;
|
||||||
const StringReplace = Function.call.bind(String.prototype.replace);
|
const StringReplace = Function.call.bind(String.prototype.replace);
|
||||||
const JsonParse = JSON.parse;
|
const JsonParse = JSON.parse;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user