buffer: remove unnecessary lazy loading

PR-URL: https://github.com/nodejs/node/pull/45807
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Antoine du Hamel 2022-12-12 14:53:27 +01:00 committed by GitHub
parent 74a6f0bd07
commit 6cef4a6b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -30,6 +30,7 @@ const {
TextDecoder,
TextEncoder,
} = require('internal/encoding');
const { URL } = require('internal/url');
const {
makeTransferable,
@ -77,7 +78,6 @@ const kMaxChunkSize = 65536;
const disallowedTypeCharacters = /[^\u{0020}-\u{007E}]/u;
let ReadableStream;
let URL;
const enc = new TextEncoder();
let dec;
@ -86,11 +86,6 @@ let dec;
// references between the url, internal/blob, and buffer
// modules, lazy loading here makes sure that things work.
function lazyURL(id) {
URL ??= require('internal/url').URL;
return new URL(id);
}
function lazyReadableStream(options) {
// eslint-disable-next-line no-global-assign
ReadableStream ??=
@ -378,7 +373,7 @@ ObjectDefineProperties(Blob.prototype, {
function resolveObjectURL(url) {
url = `${url}`;
try {
const parsed = new lazyURL(url);
const parsed = new URL(url);
const split = StringPrototypeSplit(parsed.pathname, ':');