diff --git a/src/node.js b/src/node.js index 065c337e743993..e3bb221b5e2877 100644 --- a/src/node.js +++ b/src/node.js @@ -159,8 +159,17 @@ startup.globalVariables = function() { global.process = process; global.global = global; - global.GLOBAL = global; - global.root = global; + + // Deprecate GLOBAL and root + const holders = {GLOBAL: global, root: global}; + ['GLOBAL', 'root'].forEach(function (name) { + const access = util.deprecate(function(val) { + if (val) holders[name] = val; + return holders[name]; + }, "'" + name + "' is deprecated, use 'global'"); + Object.defineProperty(global, name, {get: access, set: access}); + }); + global.Buffer = NativeModule.require('buffer').Buffer; process.domain = null; process._exiting = false;