Skip to content

Commit b61efcc

Browse files
aduh95targos
authored andcommitted
esm: rename URLCanParse to be consistent
PR-URL: #47668 Backport-PR-URL: #50669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b77a6b2 commit b61efcc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/internal/modules/esm/hooks.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const {
3333
ERR_WORKER_UNSERIALIZABLE_ERROR,
3434
} = require('internal/errors').codes;
3535
const { URL } = require('internal/url');
36-
const { canParse: urlCanParse } = internalBinding('url');
36+
const { canParse: URLCanParse } = internalBinding('url');
3737
const { receiveMessageOnPort } = require('worker_threads');
3838
const {
3939
isAnyArrayBuffer,
@@ -272,7 +272,7 @@ class Hooks {
272272
// Avoid expensive URL instantiation for known-good URLs
273273
if (!this.#validatedUrls.has(url)) {
274274
// No need to convert to string, since the type is already validated
275-
if (!urlCanParse(url)) {
275+
if (!URLCanParse(url)) {
276276
throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
277277
'a URL string',
278278
hookErrIdentifier,
@@ -351,7 +351,7 @@ class Hooks {
351351
// Avoid expensive URL instantiation for known-good URLs
352352
if (!this.#validatedUrls.has(nextUrl)) {
353353
// No need to convert to string, since the type is already validated
354-
if (!urlCanParse(nextUrl)) {
354+
if (!URLCanParse(nextUrl)) {
355355
throw new ERR_INVALID_ARG_VALUE(
356356
`${hookErrIdentifier} url`,
357357
nextUrl,

lib/internal/modules/esm/resolve.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
3838
const experimentalNetworkImports =
3939
getOptionValue('--experimental-network-imports');
4040
const typeFlag = getOptionValue('--input-type');
41-
const { URL, pathToFileURL, fileURLToPath, toPathIfFileURL, isURL } = require('internal/url');
42-
const { canParse: canParseURL } = internalBinding('url');
41+
const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
42+
const { canParse: URLCanParse } = internalBinding('url');
4343
const {
4444
ERR_INPUT_TYPE_NOT_ALLOWED,
4545
ERR_INVALID_ARG_TYPE,
@@ -395,7 +395,7 @@ function resolvePackageTargetString(
395395
if (internal && !StringPrototypeStartsWith(target, '../') &&
396396
!StringPrototypeStartsWith(target, '/')) {
397397
// No need to convert target to string, since it's already presumed to be
398-
if (!canParseURL(target)) {
398+
if (!URLCanParse(target)) {
399399
const exportTarget = pattern ?
400400
RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
401401
target + subpath;

0 commit comments

Comments
 (0)