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 support for URL instances in import.meta.resolve #54690

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Sep 1, 2024

No description provided.

@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 Sep 1, 2024
Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

Is it what browsers do too?

@aduh95
Copy link
Contributor Author

aduh95 commented Sep 1, 2024

Trying to run import('data:text/javascript,console.log(import.meta.resolve(new URL("http://example.com")))') in a browser that supports import.meta.resolve (tried with Chromium) does output http://example.com/, yes.

Copy link
Contributor

@JakobJingleheimer JakobJingleheimer left a comment

Choose a reason for hiding this comment

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

For context: I encountered an issue where import.meta.resolve(path, baseAsURLInstance) b0rks the entire execution when a loader is added (it ultimately throws a structured clone error, which gets swallowed).

@anonrig
Copy link
Member

anonrig commented Sep 1, 2024

This pull request is an amazing example of collaboration. Thank you all.

Copy link
Contributor

@LiviaMedeiros LiviaMedeiros left a comment

Choose a reason for hiding this comment

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

LGTM.
Does this also require adjustments to typings in JSDoc (

* @param {string} originalSpecifier The specified URL path of the module to
) or API docs?

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.60%. Comparing base (71b36b3) to head (05c048d).
Report is 92 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54690      +/-   ##
==========================================
- Coverage   87.61%   87.60%   -0.02%     
==========================================
  Files         650      650              
  Lines      182834   182836       +2     
  Branches    35382    35385       +3     
==========================================
- Hits       160194   160177      -17     
- Misses      15925    15926       +1     
- Partials     6715     6733      +18     
Files with missing lines Coverage Δ
lib/internal/modules/esm/loader.js 97.76% <100.00%> (+<0.01%) ⬆️

... and 35 files with indirect coverage changes

@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 Sep 2, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 2, 2024
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@jasnell
Copy link
Member

jasnell commented Sep 8, 2024

PR is currently blocked from landing due to unreliable CI

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 merged commit 2ef33af into nodejs:main Sep 9, 2024
63 of 64 checks passed
@aduh95
Copy link
Contributor Author

aduh95 commented Sep 9, 2024

Landed in 2ef33af

@aduh95 aduh95 deleted the fix-resolve-url branch September 9, 2024 23:00
aduh95 added a commit that referenced this pull request Sep 12, 2024
PR-URL: #54690
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 added a commit that referenced this pull request Sep 13, 2024
PR-URL: #54690
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: James M Snell <jasnell@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Sep 16, 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.

7 participants