Skip to content

Commit 90196b8

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace WeakMap global by the primordials
PR-URL: #31158 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent b1550a6 commit 90196b8

File tree

7 files changed

+9
-0
lines changed

7 files changed

+9
-0
lines changed

lib/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ rules:
2929
message: "Use `const { Reflect } = primordials;` instead of the global."
3030
- name: Symbol
3131
message: "Use `const { Symbol } = primordials;` instead of the global."
32+
- name: WeakMap
33+
message: "Use `const { WeakMap } = primordials;` instead of the global."
3234
no-restricted-syntax:
3335
# Config copied from .eslintrc.js
3436
- error

lib/internal/console/constructor.js

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const {
1515
ReflectOwnKeys,
1616
Symbol,
1717
SymbolHasInstance,
18+
WeakMap,
1819
} = primordials;
1920

2021
const { trace } = internalBinding('trace_events');

lib/internal/errors.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
ObjectKeys,
1919
Symbol,
2020
SymbolFor,
21+
WeakMap,
2122
} = primordials;
2223

2324
const messages = new Map();

lib/internal/process/promises.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {
44
ObjectDefineProperty,
5+
WeakMap,
56
} = primordials;
67

78
const {

lib/internal/source_map/source_map_cache.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
ObjectGetOwnPropertyDescriptor,
88
ObjectPrototypeHasOwnProperty,
99
MapPrototypeEntries,
10+
WeakMap,
1011
WeakMapPrototypeGet,
1112
uncurryThis,
1213
} = primordials;

lib/internal/vm/module.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {
66
ObjectDefineProperty,
77
SafePromise,
88
Symbol,
9+
WeakMap,
910
} = primordials;
1011

1112
const { isContext } = internalBinding('contextify');

lib/repl.js

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ const {
5858
Promise,
5959
PromiseRace,
6060
Symbol,
61+
WeakMap,
62+
WeakSet,
6163
} = primordials;
6264

6365
const {

0 commit comments

Comments
 (0)