Skip to content

Commit 0b8eaf2

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace WeakMap global by the primordials
PR-URL: #31158 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 1527796 commit 0b8eaf2

File tree

6 files changed

+7
-0
lines changed

6 files changed

+7
-0
lines changed

Diff for: 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

Diff for: lib/internal/console/constructor.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const {
1717
ReflectOwnKeys,
1818
Symbol,
1919
SymbolHasInstance,
20+
WeakMap,
2021
} = primordials;
2122

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

Diff for: 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();

Diff for: 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 {

Diff for: 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;

Diff for: lib/internal/vm/module.js

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

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

0 commit comments

Comments
 (0)