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: fix hint on invalid module specifier #51223

Merged
merged 7 commits into from
Dec 23, 2023

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Dec 19, 2023

URLs are hard to work with.

Fixes: #51216

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Dec 19, 2023
lib/internal/modules/esm/resolve.js Show resolved Hide resolved
lib/internal/modules/esm/resolve.js Show resolved Hide resolved
'/',
);
} else {
found = `${pathToFileURL(found)}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This might be a little bit more readable.

Suggested change
found = `${pathToFileURL(found)}`;
found = pathToFileURL(found).href;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we try to always "coerce to string" in core rather than calling the .href getter, that way if the prototype gets tampered with, all of core is affected consistently.

lib/internal/modules/esm/resolve.js Show resolved Hide resolved
lib/internal/modules/esm/resolve.js Outdated Show resolved Hide resolved
fix for Windows (`?` is illegal in file names apparently)
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 21, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 21, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 23, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 23, 2023
@nodejs-github-bot nodejs-github-bot merged commit a717fa2 into nodejs:main Dec 23, 2023
53 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in a717fa2

@aduh95 aduh95 deleted the fix-invalid-hint branch December 23, 2023 23:34
RafaelGSS pushed a commit that referenced this pull request Jan 2, 2024
PR-URL: #51223
Fixes: #51216
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Jan 2, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51223
Fixes: #51216
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@richardlau richardlau mentioned this pull request Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

module import errors follow different logic than importing
6 participants