Skip to content

Commit 2d578ad

Browse files
committed
lib: move DEP0026 to end of life
PR-URL: #25377 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent dce2f3e commit 2d578ad

File tree

6 files changed

+7
-27
lines changed

6 files changed

+7
-27
lines changed

doc/api/deprecations.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ The `sys` module is deprecated. Please use the [`util`][] module instead.
569569
### DEP0026: util.print()
570570
<!-- YAML
571571
changes:
572+
- version: REPLACEME
573+
pr-url: https://github.com/nodejs/node/pull/xxxxx
574+
description: End-of-Life.
572575
- version:
573576
- v4.8.6
574577
- v6.12.0
@@ -579,10 +582,9 @@ changes:
579582
description: Runtime deprecation.
580583
-->
581584

582-
Type: Runtime
585+
Type: End-of-Life
583586

584-
The [`util.print()`][] API is deprecated. Please use [`console.log()`][]
585-
instead.
587+
`util.print()` has been removed. Please use [`console.log()`][] instead.
586588

587589
<a id="DEP0027"></a>
588590
### DEP0027: util.puts()
@@ -2411,7 +2413,6 @@ Setting the TLS ServerName to an IP address is not permitted by
24112413
[`util.isSymbol()`]: util.html#util_util_issymbol_object
24122414
[`util.isUndefined()`]: util.html#util_util_isundefined_object
24132415
[`util.log()`]: util.html#util_util_log_string
2414-
[`util.print()`]: util.html#util_util_print_strings
24152416
[`util.puts()`]: util.html#util_util_puts_strings
24162417
[`util.types`]: util.html#util_util_types
24172418
[`util`]: util.html

doc/api/util.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,16 +2167,6 @@ const util = require('util');
21672167
util.log('Timestamped message.');
21682168
```
21692169

2170-
### util.print([...strings])
2171-
<!-- YAML
2172-
added: v0.3.0
2173-
deprecated: v0.11.3
2174-
-->
2175-
2176-
> Stability: 0 - Deprecated: Use [`console.log()`][] instead.
2177-
2178-
Deprecated predecessor of `console.log`.
2179-
21802170
### util.puts([...strings])
21812171
<!-- YAML
21822172
added: v0.3.0

lib/util.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,6 @@ function _extend(target, source) {
326326

327327
// Deprecated old stuff.
328328

329-
function print(...args) {
330-
for (var i = 0, len = args.length; i < len; ++i) {
331-
process.stdout.write(String(args[i]));
332-
}
333-
}
334-
335329
function puts(...args) {
336330
for (var i = 0, len = args.length; i < len; ++i) {
337331
process.stdout.write(`${args[i]}\n`);
@@ -447,9 +441,6 @@ module.exports = exports = {
447441
error: deprecate(error,
448442
'util.error is deprecated. Use console.error instead.',
449443
'DEP0029'),
450-
print: deprecate(print,
451-
'util.print is deprecated. Use console.log instead.',
452-
'DEP0026'),
453444
puts: deprecate(puts,
454445
'util.puts is deprecated. Use console.log instead.',
455446
'DEP0027')

test/fixtures/test-init-index/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
(function() {
23-
require('util').print('Loaded successfully!');
23+
process.stdout.write('Loaded successfully!');
2424
})();
2525

test/fixtures/test-init-native/fs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
(function() {
2323
const fs = require('fs');
2424
if (fs.readFile) {
25-
require('util').print('fs loaded successfully');
25+
process.stdout.write('fs loaded successfully');
2626
}
2727
})();
2828

test/parallel/test-util.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,11 @@ assert.strictEqual(util.isFunction(), false);
145145
assert.strictEqual(util.isFunction('string'), false);
146146

147147
common.expectWarning('DeprecationWarning', [
148-
['util.print is deprecated. Use console.log instead.', 'DEP0026'],
149148
['util.puts is deprecated. Use console.log instead.', 'DEP0027'],
150149
['util.debug is deprecated. Use console.error instead.', 'DEP0028'],
151150
['util.error is deprecated. Use console.error instead.', 'DEP0029']
152151
]);
153152

154-
util.print('test');
155153
util.puts('test');
156154
util.debug('test');
157155
util.error('test');

0 commit comments

Comments
 (0)