Skip to content

Commit

Permalink
lib: move GLOBAL and root aliases to EOL
Browse files Browse the repository at this point in the history
GLOBAL and root have been long deprecated.

PR-URL: #31167
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
jasnell committed Feb 6, 2020
1 parent bffa504 commit ec0dd6f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 90 deletions.
9 changes: 6 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the
### DEP0016: `GLOBAL`/`root`
<!-- YAML
changes:
- version: REPLACEME
pr-url: REPLACEME
description: End-of-Life
- version: v6.12.0
pr-url: https://github.com/nodejs/node/pull/10116
description: A deprecation code has been assigned.
Expand All @@ -412,10 +415,10 @@ changes:
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

The `GLOBAL` and `root` aliases for the `global` property are deprecated
and should no longer be used.
The `GLOBAL` and `root` aliases for the `global` property were deprecated
in Node.js 6.0.0 and have since been removed.

<a id="DEP0017"></a>
### DEP0017: `Intl.v8BreakIterator`
Expand Down
31 changes: 0 additions & 31 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ setupPrepareStackTrace();

const {
JSONParse,
ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
Expand Down Expand Up @@ -294,36 +293,6 @@ function setupGlobalProxy() {
enumerable: false,
configurable: true
});

function makeGetter(name) {
return deprecate(function() {
return this;
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
}

function makeSetter(name) {
return deprecate(function(value) {
ObjectDefineProperty(this, name, {
configurable: true,
writable: true,
enumerable: true,
value: value
});
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
}

ObjectDefineProperties(global, {
GLOBAL: {
configurable: true,
get: makeGetter('GLOBAL'),
set: makeSetter('GLOBAL')
},
root: {
configurable: true,
get: makeGetter('root'),
set: makeSetter('root')
}
});
}

function setupBuffer() {
Expand Down
110 changes: 54 additions & 56 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2532,24 +2532,23 @@ assert.strictEqual(
'unescape', 'eval', 'isFinite',
'isNaN', 'SharedArrayBuffer', 'Atomics',
'globalThis', 'WebAssembly', 'global',
'process', 'GLOBAL', 'root',
'Buffer', 'URL', 'URLSearchParams',
'TextEncoder', 'TextDecoder', 'clearInterval',
'clearTimeout', 'setInterval', 'setTimeout',
'queueMicrotask', 'clearImmediate', 'setImmediate',
'module', 'require', 'assert',
'async_hooks', 'buffer', 'child_process',
'cluster', 'crypto', 'dgram',
'dns', 'domain', 'events',
'fs', 'http', 'http2',
'https', 'inspector', 'net',
'os', 'path', 'perf_hooks',
'punycode', 'querystring', 'readline',
'repl', 'stream', 'string_decoder',
'tls', 'trace_events', 'tty',
'url', 'v8', 'vm',
'worker_threads', 'zlib', '_',
'_error', 'util'
'process', 'Buffer', 'URL',
'URLSearchParams', 'TextEncoder', 'TextDecoder',
'clearInterval', 'clearTimeout', 'setInterval',
'setTimeout', 'queueMicrotask', 'clearImmediate',
'setImmediate', 'module', 'require',
'assert', 'async_hooks', 'buffer',
'child_process', 'cluster', 'crypto',
'dgram', 'dns', 'domain',
'events', 'fs', 'http',
'http2', 'https', 'inspector',
'net', 'os', 'path',
'perf_hooks', 'punycode', 'querystring',
'readline', 'repl', 'stream',
'string_decoder', 'tls', 'trace_events',
'tty', 'url', 'v8',
'vm', 'worker_threads', 'zlib',
'_', '_error', 'util'
];

out = util.inspect(
Expand All @@ -2558,44 +2557,43 @@ assert.strictEqual(
);
expected = [
'[',
" 'Object', 'Function', 'Array',",
" 'Number', 'parseFloat', 'parseInt',",
" 'Infinity', 'NaN', 'undefined',",
" 'Boolean', 'String', 'Symbol',",
" 'Date', 'Promise', 'RegExp',",
" 'Error', 'EvalError', 'RangeError',",
" 'ReferenceError', 'SyntaxError', 'TypeError',",
" 'URIError', 'JSON', 'Math',",
" 'console', 'Intl', 'ArrayBuffer',",
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
" 'Int16Array', 'Uint32Array', 'Int32Array',",
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
" 'Map', 'BigInt', 'Set',",
" 'WeakMap', 'WeakSet', 'Proxy',",
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
" 'encodeURI', 'encodeURIComponent', 'escape',",
" 'unescape', 'eval', 'isFinite',",
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
" 'globalThis', 'WebAssembly', 'global',",
" 'process', 'GLOBAL', 'root',",
" 'Buffer', 'URL', 'URLSearchParams',",
" 'TextEncoder', 'TextDecoder', 'clearInterval',",
" 'clearTimeout', 'setInterval', 'setTimeout',",
" 'queueMicrotask', 'clearImmediate', 'setImmediate',",
" 'module', 'require', 'assert',",
" 'async_hooks', 'buffer', 'child_process',",
" 'cluster', 'crypto', 'dgram',",
" 'dns', 'domain', 'events',",
" 'fs', 'http', 'http2',",
" 'https', 'inspector', 'net',",
" 'os', 'path', 'perf_hooks',",
" 'punycode', 'querystring', 'readline',",
" 'repl', 'stream', 'string_decoder',",
" 'tls', 'trace_events', 'tty',",
" 'url', 'v8', 'vm',",
" 'worker_threads', 'zlib', '_',",
" '_error', 'util'",
" 'Object', 'Function', 'Array',",
" 'Number', 'parseFloat', 'parseInt',",
" 'Infinity', 'NaN', 'undefined',",
" 'Boolean', 'String', 'Symbol',",
" 'Date', 'Promise', 'RegExp',",
" 'Error', 'EvalError', 'RangeError',",
" 'ReferenceError', 'SyntaxError', 'TypeError',",
" 'URIError', 'JSON', 'Math',",
" 'console', 'Intl', 'ArrayBuffer',",
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
" 'Int16Array', 'Uint32Array', 'Int32Array',",
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
" 'Map', 'BigInt', 'Set',",
" 'WeakMap', 'WeakSet', 'Proxy',",
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
" 'encodeURI', 'encodeURIComponent', 'escape',",
" 'unescape', 'eval', 'isFinite',",
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
" 'globalThis', 'WebAssembly', 'global',",
" 'process', 'Buffer', 'URL',",
" 'URLSearchParams', 'TextEncoder', 'TextDecoder',",
" 'clearInterval', 'clearTimeout', 'setInterval',",
" 'setTimeout', 'queueMicrotask', 'clearImmediate',",
" 'setImmediate', 'module', 'require',",
" 'assert', 'async_hooks', 'buffer',",
" 'child_process', 'cluster', 'crypto',",
" 'dgram', 'dns', 'domain',",
" 'events', 'fs', 'http',",
" 'http2', 'https', 'inspector',",
" 'net', 'os', 'path',",
" 'perf_hooks', 'punycode', 'querystring',",
" 'readline', 'repl', 'stream',",
" 'string_decoder', 'tls', 'trace_events',",
" 'tty', 'url', 'v8',",
" 'vm', 'worker_threads', 'zlib',",
" '_', '_error', 'util'",
']'
].join('\n');

Expand Down

0 comments on commit ec0dd6f

Please sign in to comment.