From a198e0695750997be576930a9115f541eea4bbb0 Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Fri, 20 Sep 2019 06:33:10 -0400 Subject: [PATCH 1/5] process: deprecate process._tickCallback * This deprecates the `process._tickCallback` funciton and adds a more appropriatley named `process.runNextTicks ` --- doc/api/deprecations.md | 3 +++ lib/internal/bootstrap/node.js | 10 ++++++---- lib/internal/bootstrap/pre_execution.js | 4 ---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index eaaa5090f8502a..43ca378ff1aff4 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2526,6 +2526,9 @@ changes: - version: REPLACEME pr-url: https://github.com/nodejs/node/pull/29781 description: Documentation-only deprecation. + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/ + description: Runtime deprecation. --> Type: Documentation-only (supports [`--pending-deprecation`][]) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 18acd9d2b64774..0e5e47ebe906a5 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -281,10 +281,12 @@ process.emitWarning = emitWarning; const { nextTick, runNextTicks } = setupTaskQueue(); process.nextTick = nextTick; // Used to emulate a tick manually in the JS land. - // A better name for this function would be `runNextTicks` but - // it has been exposed to the process object so we keep this legacy name - // TODO(joyeecheung): either remove it or make it public - process._tickCallback = runNextTicks; + process.runNextTicks = runNextTicks; + process._tickCallback = deprecate( + runNextTicks, + 'process._tickCallback is deprecated. ', + 'DEP0134'); + const { getTimerCallbacks } = require('internal/timers'); const { setupTimers } = internalBinding('timers'); diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 174ffcd018fd31..cab2d47c8e3350 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -271,10 +271,6 @@ function initializeDeprecations() { process.binding = deprecate(process.binding, 'process.binding() is deprecated. ' + 'Please use public APIs instead.', 'DEP0111'); - - process._tickCallback = deprecate(process._tickCallback, - 'process._tickCallback() is deprecated', - 'DEP0134'); } // Create global.process and global.Buffer as getters so that we have a From 042734c98d8889849d5adb0ea2d5a3c90fa2abe8 Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Wed, 25 Sep 2019 12:12:18 -0400 Subject: [PATCH 2/5] squash: update deprecation code to be generic --- doc/api/deprecations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 43ca378ff1aff4..13442bf6458a0b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2519,8 +2519,8 @@ Type: Documentation-only Prefer [`response.socket`][] over [`response.connection`][] and [`request.socket`][] over [`request.connection`][]. - -### DEP0134: process._tickCallback + +### DEP0XXX: process._tickCallback Type: Documentation-only (supports [`--pending-deprecation`][]) From a1a9df952c678e0d49b4f31dec27b288b818a7a6 Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Fri, 4 Oct 2019 11:17:36 -0400 Subject: [PATCH 4/5] squash: small update after the rebase --- doc/api/deprecations.md | 5 +++-- lib/internal/bootstrap/node.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 85fce1d242ee24..e4ee03a2d2597d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2530,10 +2530,11 @@ changes: pr-url: https://github.com/nodejs/node/pull/29671 description: Runtime deprecation. --> -Type: Documentation-only (supports [`--pending-deprecation`][]) +Type: Runtime The `process._tickCallback` property was never documented as -an officially supported API. +an officially supported API. Please use `process.runNextTicks` +instead. [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 0e5e47ebe906a5..636bbdd14ccd04 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -284,7 +284,8 @@ process.emitWarning = emitWarning; process.runNextTicks = runNextTicks; process._tickCallback = deprecate( runNextTicks, - 'process._tickCallback is deprecated. ', + 'process._tickCallback is deprecated. ' + + 'Please use `process.runNextTicks` instead.', 'DEP0134'); From 2781b4b58753f912368a0d11a8a07a798065300e Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Mon, 7 Oct 2019 06:05:15 -0400 Subject: [PATCH 5/5] squash: put back dep code and change the metadata order --- doc/api/deprecations.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e4ee03a2d2597d..e1f416ea79d4f6 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2519,16 +2519,16 @@ Type: Documentation-only Prefer [`response.socket`][] over [`response.connection`][] and [`request.socket`][] over [`request.connection`][]. - -### DEP0XXX: process._tickCallback + +### DEP0134: process._tickCallback Type: Runtime