Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer: remove unnecessary lazy loading #45807

Merged
merged 1 commit into from Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/internal/blob.js
Expand Up @@ -30,6 +30,7 @@ const {
TextDecoder,
TextEncoder,
} = require('internal/encoding');
const { URL } = require('internal/url');

const {
makeTransferable,
Expand Down Expand Up @@ -77,7 +78,6 @@ const kMaxChunkSize = 65536;
const disallowedTypeCharacters = /[^\u{0020}-\u{007E}]/u;

let ReadableStream;
let URL;

const enc = new TextEncoder();
let dec;
Expand All @@ -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 ??=
Expand Down Expand Up @@ -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, ':');

Expand Down