Skip to content

Commit ec0dd6f

Browse files
committed
lib: move GLOBAL and root aliases to EOL
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]>
1 parent bffa504 commit ec0dd6f

File tree

3 files changed

+60
-90
lines changed

3 files changed

+60
-90
lines changed

doc/api/deprecations.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the
404404
### DEP0016: `GLOBAL`/`root`
405405
<!-- YAML
406406
changes:
407+
- version: REPLACEME
408+
pr-url: REPLACEME
409+
description: End-of-Life
407410
- version: v6.12.0
408411
pr-url: https://github.com./nodejs/node/pull/10116
409412
description: A deprecation code has been assigned.
@@ -412,10 +415,10 @@ changes:
412415
description: Runtime deprecation.
413416
-->
414417

415-
Type: Runtime
418+
Type: End-of-Life
416419

417-
The `GLOBAL` and `root` aliases for the `global` property are deprecated
418-
and should no longer be used.
420+
The `GLOBAL` and `root` aliases for the `global` property were deprecated
421+
in Node.js 6.0.0 and have since been removed.
419422

420423
<a id="DEP0017"></a>
421424
### DEP0017: `Intl.v8BreakIterator`

lib/internal/bootstrap/node.js

-31
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ setupPrepareStackTrace();
4040

4141
const {
4242
JSONParse,
43-
ObjectDefineProperties,
4443
ObjectDefineProperty,
4544
ObjectGetPrototypeOf,
4645
ObjectSetPrototypeOf,
@@ -294,36 +293,6 @@ function setupGlobalProxy() {
294293
enumerable: false,
295294
configurable: true
296295
});
297-
298-
function makeGetter(name) {
299-
return deprecate(function() {
300-
return this;
301-
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
302-
}
303-
304-
function makeSetter(name) {
305-
return deprecate(function(value) {
306-
ObjectDefineProperty(this, name, {
307-
configurable: true,
308-
writable: true,
309-
enumerable: true,
310-
value: value
311-
});
312-
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
313-
}
314-
315-
ObjectDefineProperties(global, {
316-
GLOBAL: {
317-
configurable: true,
318-
get: makeGetter('GLOBAL'),
319-
set: makeSetter('GLOBAL')
320-
},
321-
root: {
322-
configurable: true,
323-
get: makeGetter('root'),
324-
set: makeSetter('root')
325-
}
326-
});
327296
}
328297

329298
function setupBuffer() {

test/parallel/test-util-inspect.js

+54-56
Original file line numberDiff line numberDiff line change
@@ -2532,24 +2532,23 @@ assert.strictEqual(
25322532
'unescape', 'eval', 'isFinite',
25332533
'isNaN', 'SharedArrayBuffer', 'Atomics',
25342534
'globalThis', 'WebAssembly', 'global',
2535-
'process', 'GLOBAL', 'root',
2536-
'Buffer', 'URL', 'URLSearchParams',
2537-
'TextEncoder', 'TextDecoder', 'clearInterval',
2538-
'clearTimeout', 'setInterval', 'setTimeout',
2539-
'queueMicrotask', 'clearImmediate', 'setImmediate',
2540-
'module', 'require', 'assert',
2541-
'async_hooks', 'buffer', 'child_process',
2542-
'cluster', 'crypto', 'dgram',
2543-
'dns', 'domain', 'events',
2544-
'fs', 'http', 'http2',
2545-
'https', 'inspector', 'net',
2546-
'os', 'path', 'perf_hooks',
2547-
'punycode', 'querystring', 'readline',
2548-
'repl', 'stream', 'string_decoder',
2549-
'tls', 'trace_events', 'tty',
2550-
'url', 'v8', 'vm',
2551-
'worker_threads', 'zlib', '_',
2552-
'_error', 'util'
2535+
'process', 'Buffer', 'URL',
2536+
'URLSearchParams', 'TextEncoder', 'TextDecoder',
2537+
'clearInterval', 'clearTimeout', 'setInterval',
2538+
'setTimeout', 'queueMicrotask', 'clearImmediate',
2539+
'setImmediate', 'module', 'require',
2540+
'assert', 'async_hooks', 'buffer',
2541+
'child_process', 'cluster', 'crypto',
2542+
'dgram', 'dns', 'domain',
2543+
'events', 'fs', 'http',
2544+
'http2', 'https', 'inspector',
2545+
'net', 'os', 'path',
2546+
'perf_hooks', 'punycode', 'querystring',
2547+
'readline', 'repl', 'stream',
2548+
'string_decoder', 'tls', 'trace_events',
2549+
'tty', 'url', 'v8',
2550+
'vm', 'worker_threads', 'zlib',
2551+
'_', '_error', 'util'
25532552
];
25542553

25552554
out = util.inspect(
@@ -2558,44 +2557,43 @@ assert.strictEqual(
25582557
);
25592558
expected = [
25602559
'[',
2561-
" 'Object', 'Function', 'Array',",
2562-
" 'Number', 'parseFloat', 'parseInt',",
2563-
" 'Infinity', 'NaN', 'undefined',",
2564-
" 'Boolean', 'String', 'Symbol',",
2565-
" 'Date', 'Promise', 'RegExp',",
2566-
" 'Error', 'EvalError', 'RangeError',",
2567-
" 'ReferenceError', 'SyntaxError', 'TypeError',",
2568-
" 'URIError', 'JSON', 'Math',",
2569-
" 'console', 'Intl', 'ArrayBuffer',",
2570-
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
2571-
" 'Int16Array', 'Uint32Array', 'Int32Array',",
2572-
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
2573-
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
2574-
" 'Map', 'BigInt', 'Set',",
2575-
" 'WeakMap', 'WeakSet', 'Proxy',",
2576-
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
2577-
" 'encodeURI', 'encodeURIComponent', 'escape',",
2578-
" 'unescape', 'eval', 'isFinite',",
2579-
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
2580-
" 'globalThis', 'WebAssembly', 'global',",
2581-
" 'process', 'GLOBAL', 'root',",
2582-
" 'Buffer', 'URL', 'URLSearchParams',",
2583-
" 'TextEncoder', 'TextDecoder', 'clearInterval',",
2584-
" 'clearTimeout', 'setInterval', 'setTimeout',",
2585-
" 'queueMicrotask', 'clearImmediate', 'setImmediate',",
2586-
" 'module', 'require', 'assert',",
2587-
" 'async_hooks', 'buffer', 'child_process',",
2588-
" 'cluster', 'crypto', 'dgram',",
2589-
" 'dns', 'domain', 'events',",
2590-
" 'fs', 'http', 'http2',",
2591-
" 'https', 'inspector', 'net',",
2592-
" 'os', 'path', 'perf_hooks',",
2593-
" 'punycode', 'querystring', 'readline',",
2594-
" 'repl', 'stream', 'string_decoder',",
2595-
" 'tls', 'trace_events', 'tty',",
2596-
" 'url', 'v8', 'vm',",
2597-
" 'worker_threads', 'zlib', '_',",
2598-
" '_error', 'util'",
2560+
" 'Object', 'Function', 'Array',",
2561+
" 'Number', 'parseFloat', 'parseInt',",
2562+
" 'Infinity', 'NaN', 'undefined',",
2563+
" 'Boolean', 'String', 'Symbol',",
2564+
" 'Date', 'Promise', 'RegExp',",
2565+
" 'Error', 'EvalError', 'RangeError',",
2566+
" 'ReferenceError', 'SyntaxError', 'TypeError',",
2567+
" 'URIError', 'JSON', 'Math',",
2568+
" 'console', 'Intl', 'ArrayBuffer',",
2569+
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
2570+
" 'Int16Array', 'Uint32Array', 'Int32Array',",
2571+
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
2572+
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
2573+
" 'Map', 'BigInt', 'Set',",
2574+
" 'WeakMap', 'WeakSet', 'Proxy',",
2575+
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
2576+
" 'encodeURI', 'encodeURIComponent', 'escape',",
2577+
" 'unescape', 'eval', 'isFinite',",
2578+
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
2579+
" 'globalThis', 'WebAssembly', 'global',",
2580+
" 'process', 'Buffer', 'URL',",
2581+
" 'URLSearchParams', 'TextEncoder', 'TextDecoder',",
2582+
" 'clearInterval', 'clearTimeout', 'setInterval',",
2583+
" 'setTimeout', 'queueMicrotask', 'clearImmediate',",
2584+
" 'setImmediate', 'module', 'require',",
2585+
" 'assert', 'async_hooks', 'buffer',",
2586+
" 'child_process', 'cluster', 'crypto',",
2587+
" 'dgram', 'dns', 'domain',",
2588+
" 'events', 'fs', 'http',",
2589+
" 'http2', 'https', 'inspector',",
2590+
" 'net', 'os', 'path',",
2591+
" 'perf_hooks', 'punycode', 'querystring',",
2592+
" 'readline', 'repl', 'stream',",
2593+
" 'string_decoder', 'tls', 'trace_events',",
2594+
" 'tty', 'url', 'v8',",
2595+
" 'vm', 'worker_threads', 'zlib',",
2596+
" '_', '_error', 'util'",
25992597
']'
26002598
].join('\n');
26012599

0 commit comments

Comments
 (0)