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: mark importAssertions as required #46164

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 10, 2023

We already always specify a value, and failing to do so would likely be a bug.

We already always specify a value, and failing to do so would likely be
a bug.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/modules

@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 Jan 10, 2023
Copy link
Member

@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.

I'm not sure neglecting to provide a value is a bug, but happy to be corrected. Could you provide some rationale as to how/why it might be?

lib/internal/modules/esm/loader.js Outdated Show resolved Hide resolved
@aduh95
Copy link
Contributor Author

aduh95 commented Jan 10, 2023

I'm not sure neglecting to provide a value is a bug, but happy to be corrected. Could you provide some rationale as to how/why it might be?

V8 always provides an object that represents the import assertions for a specific import, so if the value is ever undefined, that means we probably forgot to pass the value from V8 to the loader, and that would be clearly a bug. Let me return the question: in what scenario would it be OK to call this function with only two parameters instead of three?

@JakobJingleheimer
Copy link
Member

V8 always provides an object that represents the import assertions for a specific import, so if the value is ever undefined, that means we probably forgot to pass the value from V8 to the loader, and that would be clearly a bug.

Ah, maybe yes 🤔

Let me return the question: in what scenario would it be OK to call this function with only two parameters instead of three?

I don't know of a specific scenario; I think likely never. The optional param is a convenience.

@aduh95
Copy link
Contributor Author

aduh95 commented Jan 10, 2023

The optional param is a convenience.

In this case, I think it's more of a footgun than a convenience.

Copy link
Member

@GeoffreyBooth GeoffreyBooth left a comment

Choose a reason for hiding this comment

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

Discussed in #46153 (review)

@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 Jan 10, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 10, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@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 Jan 12, 2023
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 12, 2023
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/46164
✔  Done loading data for nodejs/node/pull/46164
----------------------------------- PR info ------------------------------------
Title      esm: mark `importAssertions` as required (#46164)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     aduh95:import-assertions-required -> nodejs:main
Labels     esm, author ready, needs-ci
Commits    4
 - esm: mark `importAssertions` as required
 - Apply suggestions from code review
 - Update lib/internal/modules/esm/loader.js
 - Update lib/internal/modules/esm/loader.js
Committers 2
 - Antoine du Hamel 
 - GitHub 
PR-URL: https://github.com/nodejs/node/pull/46164
Reviewed-By: Geoffrey Booth 
Reviewed-By: Michaël Zasso 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/46164
Reviewed-By: Geoffrey Booth 
Reviewed-By: Michaël Zasso 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 10 Jan 2023 20:52:50 GMT
   ✔  Approvals: 2
   ✔  - Geoffrey Booth (@GeoffreyBooth) (TSC): https://github.com/nodejs/node/pull/46164#pullrequestreview-1243081831
   ✔  - Michaël Zasso (@targos) (TSC): https://github.com/nodejs/node/pull/46164#pullrequestreview-1243560207
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2023-01-12T12:56:16Z: https://ci.nodejs.org/job/node-test-pull-request/48954/
- Querying data for job/node-test-pull-request/48954/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 46164
From https://github.com/nodejs/node
 * branch                  refs/pull/46164/merge -> FETCH_HEAD
✔  Fetched commits as 91ca2d404192..cd7f6e652d81
--------------------------------------------------------------------------------
Auto-merging lib/internal/modules/esm/loader.js
[main 26c2ef0f51] esm: mark `importAssertions` as required
 Author: Antoine du Hamel 
 Date: Tue Jan 10 21:47:00 2023 +0100
 1 file changed, 4 insertions(+), 12 deletions(-)
Auto-merging lib/internal/modules/esm/loader.js
[main f85caff68f] Apply suggestions from code review
 Author: Antoine du Hamel 
 Date: Tue Jan 10 23:26:57 2023 +0100
 1 file changed, 6 insertions(+), 2 deletions(-)
Auto-merging lib/internal/modules/esm/loader.js
[main fac5d98694] Update lib/internal/modules/esm/loader.js
 Author: Antoine du Hamel 
 Date: Tue Jan 10 23:31:30 2023 +0100
 1 file changed, 3 insertions(+), 3 deletions(-)
Auto-merging lib/internal/modules/esm/loader.js
[main 41bb707d5d] Update lib/internal/modules/esm/loader.js
 Author: Antoine du Hamel 
 Date: Tue Jan 10 23:31:51 2023 +0100
 1 file changed, 1 insertion(+), 1 deletion(-)
   ✔  Patches applied
There are 4 commits in the PR. Attempting autorebase.
Rebasing (2/8)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
esm: mark importAssertions as required

We already always specify a value, and failing to do so would likely be
a bug.

PR-URL: #46164
Reviewed-By: Geoffrey Booth [email protected]
Reviewed-By: Michaël Zasso [email protected]

[detached HEAD b4bc551792] esm: mark importAssertions as required
Author: Antoine du Hamel [email protected]
Date: Tue Jan 10 21:47:00 2023 +0100
1 file changed, 4 insertions(+), 12 deletions(-)
Rebasing (3/8)
Rebasing (4/8)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Apply suggestions from code review

PR-URL: #46164
Reviewed-By: Geoffrey Booth [email protected]
Reviewed-By: Michaël Zasso [email protected]

[detached HEAD ea0b8ae48a] Apply suggestions from code review
Author: Antoine du Hamel [email protected]
Date: Tue Jan 10 23:26:57 2023 +0100
1 file changed, 6 insertions(+), 2 deletions(-)
Rebasing (5/8)
Rebasing (6/8)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update lib/internal/modules/esm/loader.js

PR-URL: #46164
Reviewed-By: Geoffrey Booth [email protected]
Reviewed-By: Michaël Zasso [email protected]

[detached HEAD 0e1df065cf] Update lib/internal/modules/esm/loader.js
Author: Antoine du Hamel [email protected]
Date: Tue Jan 10 23:31:30 2023 +0100
1 file changed, 3 insertions(+), 3 deletions(-)
Rebasing (7/8)
Rebasing (8/8)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update lib/internal/modules/esm/loader.js

PR-URL: #46164
Reviewed-By: Geoffrey Booth [email protected]
Reviewed-By: Michaël Zasso [email protected]

[detached HEAD e0bbd50458] Update lib/internal/modules/esm/loader.js
Author: Antoine du Hamel [email protected]
Date: Tue Jan 10 23:31:51 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/3905995776

@GeoffreyBooth GeoffreyBooth added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 12, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 12, 2023
@nodejs-github-bot nodejs-github-bot merged commit 31ea7be into nodejs:main Jan 12, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 31ea7be

@aduh95 aduh95 deleted the import-assertions-required branch January 13, 2023 00:04
RafaelGSS pushed a commit to RafaelGSS/node that referenced this pull request Jan 17, 2023
We already always specify a value, and failing to do so would likely be
a bug.

PR-URL: nodejs#46164
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Jan 20, 2023
We already always specify a value, and failing to do so would likely be
a bug.

PR-URL: #46164
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Jan 20, 2023
@juanarbol juanarbol added the backport-requested-v18.x PRs awaiting manual backport to the v18.x-staging branch. label Jan 25, 2023
@juanarbol

This comment was marked as outdated.

@juanarbol juanarbol removed the backport-requested-v18.x PRs awaiting manual backport to the v18.x-staging branch. label Jan 25, 2023
juanarbol pushed a commit that referenced this pull request Jan 26, 2023
We already always specify a value, and failing to do so would likely be
a bug.

PR-URL: #46164
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@juanarbol juanarbol mentioned this pull request Jan 28, 2023
juanarbol pushed a commit that referenced this pull request Jan 31, 2023
We already always specify a value, and failing to do so would likely be
a bug.

PR-URL: #46164
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
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. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. 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.

6 participants