FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

module: package exports dot main support by guybedford · Pull Request #29494 · nodejs/node · GitHub

/ node Public

module: package exports dot main support - #29494

Closed
guybedford wants to merge 4 commits into
nodejs:masterfrom
guybedford:dot-main
Closed

module: package exports dot main support#29494
guybedford wants to merge 4 commits into
nodejs:masterfrom
guybedford:dot-main

Conversation

Copy link
Copy Markdown
Contributor

This reintroduces the dot main in exports as discussed in the previous Node.js modules meeting.

The implementation includes both CommonJS and ES module resolution with the associated documentation and resolver specification changes.

In addition to the dot main, "exports" as a string or direct fallback array is supported as well.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Sep 8, 2019

Copy link
Copy Markdown
Contributor Author

//cc @nodejs/modules-active-members

guybedford requested a review from hybrist September 8, 2019 17:09
Comment thread doc/api/esm.md Outdated
Comment thread doc/api/esm.md Outdated
guybedford and others added 3 commits September 8, 2019 15:29
Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>

Copy link
Copy Markdown
Member

Random governance question - who is supposed to approve these changes? Modules team members or core collaborators?

Has the TSC chartered the module team to make changes to this area of the code on its own or something similar?

(I am asking because I see two approvals by non-collaborator members and I am a bit confused if those LGTMs are "I agree with this change and it can land" "I agree with this change" or "This is what the team said" and if regular collaborators are expected to review those or not)

devsnek commented Sep 8, 2019

Copy link
Copy Markdown
Member

cc @MylesBorins ^

Copy link
Copy Markdown
Contributor Author

@benjamingr the standard Node.js core approval process applies since the modules group is not chartered. We typically seek consensus from the modules group before landing non-patch changes to the module system though.

Copy link
Copy Markdown
Member

Thanks for explaining @guybedford!

Comment thread src/module_wrap.cc

hybrist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM in general but I'd prefer if we can remove the duplication between the code for . and other exports keys.

Comment thread src/module_wrap.cc
target =
exports_obj->Get(env->context(), dot_string).ToLocalChecked();
}
if (target->IsString()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a way to reuse the existing logic for string/array in PackageExportsResolve?

guybedford Sep 9, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That would be better, it's just a refactoring I haven't had the time for. Would you be ok with moving that to a follow-up?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Works for me.

Copy link
Copy Markdown
Contributor Author

It's worth noting here, that:

{
  "exports": "./esm-main.js"
}

is supported by this PR, but:

{
  "exports": "esm-main.js"
}

would not be supported and would throw an error that exports must start with ./.

This is based on various long-standing discussions, but still worth noting in how it deviates from "main".

MylesBorins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

guybedford added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Sep 16, 2019

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

hybrist commented Sep 16, 2019

Copy link
Copy Markdown
Contributor

🍏

Trott commented Sep 18, 2019

Copy link
Copy Markdown
Member

Landed in 3f3ad38

Trott closed this Sep 18, 2019
Trott pushed a commit that referenced this pull request Sep 18, 2019
This reintroduces the dot main in exports as discussed in the previous
Node.js modules meeting.

The implementation includes both CommonJS and ES module resolution with
the associated documentation and resolver specification changes.

In addition to the dot main, "exports" as a string or direct fallback
array is supported as well.

Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
PR-URL: #29494
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
targos pushed a commit that referenced this pull request Sep 20, 2019
This reintroduces the dot main in exports as discussed in the previous
Node.js modules meeting.

The implementation includes both CommonJS and ES module resolution with
the associated documentation and resolver specification changes.

In addition to the dot main, "exports" as a string or direct fallback
array is supported as well.

Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
PR-URL: #29494
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
BridgeAR mentioned this pull request Sep 24, 2019
BridgeAR pushed a commit that referenced this pull request Sep 25, 2019
This reintroduces the dot main in exports as discussed in the previous
Node.js modules meeting.

The implementation includes both CommonJS and ES module resolution with
the associated documentation and resolver specification changes.

In addition to the dot main, "exports" as a string or direct fallback
array is supported as well.

Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
PR-URL: #29494
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL