GeezerVison is showing github.com — lib: consolidate redundant require() calls · nodejs/node@92d7921
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/_http_outgoing.js +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,12 +25,11 @@ const assert = require('assert').ok; |
25 | 25 | const Stream = require('stream'); |
26 | 26 | const util = require('util'); |
27 | 27 | const internalUtil = require('internal/util'); |
28 | | -const internalHttp = require('internal/http'); |
| 28 | +const { outHeadersKey, utcDate } = require('internal/http'); |
29 | 29 | const { Buffer } = require('buffer'); |
30 | 30 | const common = require('_http_common'); |
31 | 31 | const checkIsHttpToken = common._checkIsHttpToken; |
32 | 32 | const checkInvalidHeaderChar = common._checkInvalidHeaderChar; |
33 | | -const { outHeadersKey } = require('internal/http'); |
34 | 33 | const { |
35 | 34 | defaultTriggerAsyncIdScope, |
36 | 35 | symbols: { async_id_symbol } |
@@ -48,7 +47,6 @@ const { |
48 | 47 | } = require('internal/errors').codes; |
49 | 48 |
|
50 | 49 | const { CRLF, debug } = common; |
51 | | -const { utcDate } = internalHttp; |
52 | 50 |
|
53 | 51 | const kIsCorked = Symbol('isCorked'); |
54 | 52 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/crypto/random.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | const { AsyncWrap, Providers } = process.binding('async_wrap'); |
4 | | -const { Buffer } = require('buffer'); |
| 4 | +const { Buffer, kMaxLength } = require('buffer'); |
5 | 5 | const { randomBytes: _randomBytes } = process.binding('crypto'); |
6 | 6 | const { |
7 | 7 | ERR_INVALID_ARG_TYPE, |
@@ -10,7 +10,6 @@ const { |
10 | 10 | } = require('internal/errors').codes; |
11 | 11 | const { isArrayBufferView } = require('internal/util/types'); |
12 | 12 |
|
13 | | -const { kMaxLength } = require('buffer'); |
14 | 13 | const kMaxUint32 = 2 ** 32 - 1; |
15 | 14 | const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32); |
16 | 15 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/http2/core.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
2 | 2 |
|
3 | 3 | /* eslint-disable no-use-before-define */ |
4 | 4 |
|
5 | | -require('internal/util').assertCrypto(); |
| 5 | +const internalUtil = require('internal/util'); |
| 6 | +internalUtil.assertCrypto(); |
6 | 7 |
|
7 | 8 | const { internalBinding } = require('internal/bootstrap/loaders'); |
8 | 9 | const { async_id_symbol } = require('internal/async_hooks').symbols; |
@@ -71,7 +72,7 @@ const { utcDate } = require('internal/http'); |
71 | 72 | const { |
72 | 73 | promisify, |
73 | 74 | customInspectSymbol: kInspect |
74 | | -} = require('internal/util'); |
| 75 | +} = internalUtil; |
75 | 76 | const { isArrayBufferView } = require('internal/util/types'); |
76 | 77 | const { defaultTriggerAsyncIdScope } = require('internal/async_hooks'); |
77 | 78 | const { _connectionListener: httpConnectionListener } = http; |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/translators.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,8 +14,9 @@ const fs = require('fs'); |
14 | 14 | const { _makeLong } = require('path'); |
15 | 15 | const { SafeMap } = require('internal/safe_globals'); |
16 | 16 | const { URL } = require('url'); |
17 | | -const debug = require('util').debuglog('esm'); |
18 | | -const readFileAsync = require('util').promisify(fs.readFile); |
| 17 | +const util = require('util'); |
| 18 | +const debug = util.debuglog('esm'); |
| 19 | +const readFileAsync = util.promisify(fs.readFile); |
19 | 20 | const readFileSync = fs.readFileSync; |
20 | 21 | const StringReplace = Function.call.bind(String.prototype.replace); |
21 | 22 | const JsonParse = JSON.parse; |
|