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

esm: rename URLCanParse to be consistent #47668

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/internal/modules/esm/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {
} = require('internal/errors').codes;
const { exitCodes: { kUnfinishedTopLevelAwait } } = internalBinding('errors');
const { URL } = require('internal/url');
const { canParse: urlCanParse } = internalBinding('url');
const { canParse: URLCanParse } = internalBinding('url');
const { receiveMessageOnPort } = require('worker_threads');
const {
isAnyArrayBuffer,
Expand Down Expand Up @@ -274,7 +274,7 @@ class Hooks {
// Avoid expensive URL instantiation for known-good URLs
if (!this.#validatedUrls.has(url)) {
// No need to convert to string, since the type is already validated
if (!urlCanParse(url)) {
if (!URLCanParse(url)) {
throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
'a URL string',
hookErrIdentifier,
Expand Down Expand Up @@ -354,7 +354,7 @@ class Hooks {
// Avoid expensive URL instantiation for known-good URLs
if (!this.#validatedUrls.has(nextUrl)) {
// No need to convert to string, since the type is already validated
if (!urlCanParse(nextUrl)) {
if (!URLCanParse(nextUrl)) {
throw new ERR_INVALID_ARG_VALUE(
`${hookErrIdentifier} url`,
nextUrl,
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const experimentalNetworkImports =
getOptionValue('--experimental-network-imports');
const typeFlag = getOptionValue('--input-type');
const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
const { canParse: canParseURL } = internalBinding('url');
const { canParse: URLCanParse } = internalBinding('url');
const {
ERR_INPUT_TYPE_NOT_ALLOWED,
ERR_INVALID_ARG_TYPE,
Expand Down Expand Up @@ -328,7 +328,7 @@ function resolvePackageTargetString(
if (internal && !StringPrototypeStartsWith(target, '../') &&
!StringPrototypeStartsWith(target, '/')) {
// No need to convert target to string, since it's already presumed to be
if (!canParseURL(target)) {
if (!URLCanParse(target)) {
const exportTarget = pattern ?
RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
target + subpath;
Expand Down