From a494d127236d09e4413631c33ee95c1324eb8814 Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Mon, 6 Jan 2020 03:48:14 +0100 Subject: [PATCH] lib: add RegExp primordials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/31208 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- lib/.eslintrc.yaml | 2 ++ lib/_tls_wrap.js | 1 + lib/internal/net.js | 1 + lib/internal/policy/sri.js | 1 + lib/internal/readline/utils.js | 1 + lib/internal/util/debuglog.js | 4 ++++ lib/internal/util/inspect.js | 1 + lib/repl.js | 1 + 8 files changed, 12 insertions(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 16ab2f5028572a..4344e4a461b701 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -35,6 +35,8 @@ rules: message: "Use `const { Promise } = primordials;` instead of the global." - name: Reflect message: "Use `const { Reflect } = primordials;` instead of the global." + - name: RegExp + message: "Use `const { RegExp } = primordials;` instead of the global." - name: Set message: "Use `const { Set } = primordials;` instead of the global." - name: Symbol diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 47a59c02fc5552..aeb1cfe7af9682 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -25,6 +25,7 @@ const { ObjectAssign, ObjectDefineProperty, ObjectSetPrototypeOf, + RegExp, Symbol, SymbolFor, } = primordials; diff --git a/lib/internal/net.js b/lib/internal/net.js index 5f6e476b58295d..728c6f587a82f7 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -1,6 +1,7 @@ 'use strict'; const { + RegExp, Symbol, } = primordials; diff --git a/lib/internal/policy/sri.js b/lib/internal/policy/sri.js index 38d7fc9e07d741..d70df5c1aa1f7b 100644 --- a/lib/internal/policy/sri.js +++ b/lib/internal/policy/sri.js @@ -5,6 +5,7 @@ const { ObjectDefineProperty, ObjectFreeze, ObjectSeal, + RegExp, RegExpPrototypeExec, RegExpPrototypeTest, StringPrototypeSlice, diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index ee3a477744d10e..3ff50124e74e70 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -3,6 +3,7 @@ const { Boolean, NumberIsInteger, + RegExp, } = primordials; // Regex used for ansi escape code splitting diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 9834668307da0c..72eb797474ab59 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -1,5 +1,9 @@ 'use strict'; +const { + RegExp, +} = primordials; + const { inspect, format, formatWithOptions } = require('internal/util/inspect'); // `debugs` is deliberately initialized to undefined so any call to diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index c021d793c95d4d..3f2f75b909663b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -35,6 +35,7 @@ const { ObjectPrototypeHasOwnProperty, ObjectPrototypePropertyIsEnumerable, ObjectSeal, + RegExp, RegExpPrototypeToString, Set, SetPrototype, diff --git a/lib/repl.js b/lib/repl.js index 9fda04406ecd87..94457557c865ce 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -56,6 +56,7 @@ const { ObjectSetPrototypeOf, Promise, PromiseRace, + RegExp, Set, Symbol, WeakSet,