From b29beef2f568311f054e12719c6bdcf8b173e50c Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Mon, 6 Jan 2020 03:55:31 +0100 Subject: [PATCH 1/3] lib: add String primordials --- lib/.eslintrc.yaml | 2 ++ lib/_http_client.js | 1 + lib/assert.js | 1 + lib/events.js | 1 + lib/internal/assert/assertion_error.js | 1 + lib/internal/bootstrap/loaders.js | 1 + lib/internal/errors.js | 4 ++++ lib/internal/http2/util.js | 1 + lib/internal/modules/cjs/loader.js | 3 +++ lib/internal/process/warning.js | 1 + lib/internal/readline/utils.js | 6 ++++++ lib/internal/url.js | 1 + lib/internal/util/inspect.js | 1 + lib/internal/worker.js | 1 + lib/querystring.js | 1 + lib/tls.js | 1 + lib/wasi.js | 1 + 17 files changed, 28 insertions(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 0592218e5705a7..2cb1651593fd3c 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -41,6 +41,8 @@ rules: message: "Use `const { RegExp } = primordials;` instead of the global." - name: Set message: "Use `const { Set } = primordials;` instead of the global." + - name: String + message: "Use `const { String } = primordials;` instead of the global." - name: Symbol message: "Use `const { Symbol } = primordials;` instead of the global." - name: Uint16Array diff --git a/lib/_http_client.js b/lib/_http_client.js index 3093047bd731f2..d271a4ae7de1dd 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -29,6 +29,7 @@ const { ObjectAssign, ObjectKeys, ObjectSetPrototypeOf, + String, Symbol } = primordials; diff --git a/lib/assert.js b/lib/assert.js index 6ad672d698602d..08ef18240925ba 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -29,6 +29,7 @@ const { Map, NumberIsNaN, RegExpPrototypeTest, + String, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/events.js b/lib/events.js index fc2f969ea37ef6..4f625ce115e0f1 100644 --- a/lib/events.js +++ b/lib/events.js @@ -36,6 +36,7 @@ const { PromiseResolve, ReflectApply, ReflectOwnKeys, + String, Symbol, SymbolFor, SymbolAsyncIterator diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js index 3c2150c69e4e09..c89219eef82224 100644 --- a/lib/internal/assert/assertion_error.js +++ b/lib/internal/assert/assertion_error.js @@ -7,6 +7,7 @@ const { ObjectDefineProperty, ObjectGetPrototypeOf, ObjectKeys, + String, } = primordials; const { inspect } = require('internal/util/inspect'); diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index c4ef1d12a2974c..127ef67c36eb64 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -52,6 +52,7 @@ const { ObjectPrototypeHasOwnProperty, ReflectGet, SafeSet, + String, } = primordials; // Set up process.moduleLoadList. diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 5af14fe60b0836..3a752557043c5a 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -19,8 +19,12 @@ const { NumberIsInteger, ObjectDefineProperty, ObjectKeys, +<<<<<<< HEAD StringPrototypeSlice, StringPrototypeStartsWith, +======= + String, +>>>>>>> lib: add String primordials Symbol, SymbolFor, WeakMap, diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index dcc1355a3230fd..a2eb62fa1d0638 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -8,6 +8,7 @@ const { ObjectCreate, ObjectKeys, Set, + String, Symbol, } = primordials; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index a128cb2adaff50..2d635934d763f8 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -39,7 +39,10 @@ const { ReflectSet, RegExpPrototypeTest, SafeMap, +<<<<<<< HEAD SafeWeakMap, +======= +>>>>>>> lib: add String primordials String, StringPrototypeIndexOf, StringPrototypeLastIndexOf, diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js index 82bff2ece9e146..60048fa175fadb 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -3,6 +3,7 @@ const { ArrayIsArray, Error, + String, } = primordials; const assert = require('internal/assert'); diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index 0b9fe8cde4f5ce..a0b75adce28adc 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -1,7 +1,13 @@ 'use strict'; const { +<<<<<<< HEAD Symbol, +======= + Boolean, + NumberIsInteger, + String, +>>>>>>> lib: add String primordials } = primordials; const kUTF16SurrogateThreshold = 0x10000; // 2 ** 16 diff --git a/lib/internal/url.js b/lib/internal/url.js index c0b8c17d098708..272298334b9ba6 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -11,6 +11,7 @@ const { ObjectKeys, ReflectGetOwnPropertyDescriptor, ReflectOwnKeys, + String, Symbol, SymbolIterator, SymbolToStringTag, diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index fbc0a4ee2d6b6e..7ad4eb90e7ce52 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -42,6 +42,7 @@ const { Set, SetPrototype, SetPrototypeValues, + String, StringPrototypeValueOf, SymbolPrototypeToString, SymbolPrototypeValueOf, diff --git a/lib/internal/worker.js b/lib/internal/worker.js index 4f01f331349f4c..a6fd56e9758049 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -9,6 +9,7 @@ const { ObjectEntries, Promise, PromiseResolve, + String, Symbol, SymbolFor, } = primordials; diff --git a/lib/querystring.js b/lib/querystring.js index 954b35d69e3fbd..260d1eaaef3fa7 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -28,6 +28,7 @@ const { ArrayIsArray, ObjectCreate, ObjectKeys, + String, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/tls.js b/lib/tls.js index 2ccbe409c96c2d..92e8e07dd3c289 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -26,6 +26,7 @@ const { ArrayIsArray, ObjectDefineProperty, ObjectFreeze, + String, } = primordials; const { diff --git a/lib/wasi.js b/lib/wasi.js index d3125ca7abd9d2..573b095fc09650 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -4,6 +4,7 @@ const { ArrayPrototypePush, FunctionPrototypeBind, ObjectEntries, + String, Symbol, } = primordials; From a5dad501538a5692f4fb0a99b943edc2ad74bb5e Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Fri, 29 May 2020 11:51:17 +0200 Subject: [PATCH 2/3] fix: resolve conflicts --- lib/internal/errors.js | 3 --- lib/internal/event_target.js | 1 + lib/internal/modules/cjs/loader.js | 3 --- lib/internal/readline/utils.js | 7 +------ 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 3a752557043c5a..136707aed286d0 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -19,12 +19,9 @@ const { NumberIsInteger, ObjectDefineProperty, ObjectKeys, -<<<<<<< HEAD StringPrototypeSlice, StringPrototypeStartsWith, -======= String, ->>>>>>> lib: add String primordials Symbol, SymbolFor, WeakMap, diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 4cc561f95c0bba..0f4abfe4e9414c 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -6,6 +6,7 @@ const { Map, Object, Set, + String, Symbol, NumberIsNaN, } = primordials; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 2d635934d763f8..a128cb2adaff50 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -39,10 +39,7 @@ const { ReflectSet, RegExpPrototypeTest, SafeMap, -<<<<<<< HEAD SafeWeakMap, -======= ->>>>>>> lib: add String primordials String, StringPrototypeIndexOf, StringPrototypeLastIndexOf, diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index a0b75adce28adc..46c2a76b5bb5cd 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -1,13 +1,8 @@ 'use strict'; const { -<<<<<<< HEAD - Symbol, -======= - Boolean, - NumberIsInteger, String, ->>>>>>> lib: add String primordials + Symbol } = primordials; const kUTF16SurrogateThreshold = 0x10000; // 2 ** 16 From c5ea00844db5ae48ab7b646ebcc4e08f7befbe04 Mon Sep 17 00:00:00 2001 From: Sebastien <30870051+Sebastien-Ahkrin@users.noreply.github.com> Date: Thu, 11 Jun 2020 10:45:02 +0200 Subject: [PATCH 3/3] Update lib/internal/readline/utils.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaƫl Zasso --- lib/internal/readline/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index 46c2a76b5bb5cd..7a3fa53672f69f 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -2,7 +2,7 @@ const { String, - Symbol + Symbol, } = primordials; const kUTF16SurrogateThreshold = 0x10000; // 2 ** 16