A few patterns (modulo destructuring):
Replace require('util').inherits() usages under lib: Remove util.inherits usage internally? #24395 // Change this util . inherits ( A , B ) ; // To this Object . setPrototypeOf ( A . prototype , B . prototype ) ; Object . setPrototypeOf ( A , B ) ; Replace require('util').inspect with require('internal/util/inspect').inspect Replace require('util').format with require('internal/util/inspect').format Replace require('util').debuglog with require('internal/util/debuglog').debuglog Replace require('util').types with require('internal/util/types') Replace require('util').deprecate with require('internal/util').deprecate Replace require('util').promisify with require('internal/util').promisify List of JS files that can be refactored:
Refactored Subsystem Files PR assert lib/assert.js#L32 , lib/internal/assert/assertion_error.js#L3 #26762 , #26750 bootstrap lib/internal/bootstrap/node.js#L192 #26547 child_process lib/child_process.js#L24 , lib/internal/child_process.js#L21 #26769 , #26773 console lib/internal/console/constructor.js#L18 #26777 dgram lib/dgram.js#L48 #26770 domain lib/domain.js#L29 encoding lib/internal/encoding.js#L330 #26779 errors lib/internal/error-serdes.js#L83 , lib/internal/errors.js#L210 #26782 , #26781 fs lib/internal/fs/utils.js#L15 #26783 http lib/_http_agent.js#L25 , lib/_http_common.js#L39 , lib/_http_outgoing.js#L26 , lib/_http_server.js#L24 #26548 http2 lib/internal/http2/core.js#L21 #26789 https lib/https.js#L28 #26772 inspector lib/inspector.js#L19 lib lib/internal/policy/manifest.js#L7 #26833 module lib/internal/modules/cjs/loader.js#L26 , lib/internal/modules/esm/create_dynamic_module.js#L4 , lib/internal/modules/esm/loader.js#L21 , lib/internal/modules/esm/module_map.js#L7 , lib/internal/modules/esm/translators.js#L22 #26802 , #26803 , #26804 , #26805 , #26806 net lib/net.js#L26 #26807 process lib/internal/process/per_thread.js#L18 #26817 readline lib/readline.js#L35 #26818 repl lib/internal/repl/history.js#L7 , lib/repl.js#L55 #26819 #26820 stream lib/internal/js_stream_socket.js#L4 , lib/internal/streams/buffer_list.js#L4 , lib/internal/streams/lazy_transform.js#L7 , lib/stream.js#L46 #26698 timers lib/internal/timers.js#L19 , lib/timers.js#L43 tls lib/_tls_wrap.js#L30 #26747 trace_events lib/trace_events.js#L22 #26822 tty lib/tty.js#L24 #26797 url lib/internal/url.js#L3 #26808 vm lib/internal/vm/source_text_module.js#L3 , lib/vm.js#L35 #26716 worker lib/internal/main/worker_thread.js#L46 , lib/internal/worker/io.js#L17 #26814 , #26810 zlib lib/zlib.js#L38 #26716
A few patterns (modulo destructuring):
require('util').inherits()usages underlib: Remove util.inherits usage internally? #24395require('util').inspectwithrequire('internal/util/inspect').inspectrequire('util').formatwithrequire('internal/util/inspect').formatrequire('util').debuglogwithrequire('internal/util/debuglog').debuglogrequire('util').typeswithrequire('internal/util/types')require('util').deprecatewithrequire('internal/util').deprecaterequire('util').promisifywithrequire('internal/util').promisifyList of JS files that can be refactored:
lib/domain.js#L29lib/inspector.js#L19