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

module: unflag resolve self #31002

Closed
wants to merge 2 commits into from

Conversation

guybedford
Copy link
Contributor

@guybedford guybedford commented Dec 17, 2019

Unflags the --experimental-resolve-self option, which allows packages to load their own "exports" definitions through an import to their own package name.

For CommonJS this approach is backwards-compatible because the own name resolution is only attempted after all other resolutions fail.

Backwards compatibility is now ensured by only supporting own-name resolution when "exports" in the package.json is set. When it is, this resolution applies before any node_modules lookup checks.

Opening now to discuss along with overall resolver stability concerns.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Dec 17, 2019
@guybedford
Copy link
Contributor Author

//cc @nodejs/modules-active-members

@MylesBorins MylesBorins added the modules-agenda Issues and PRs to discuss during the meetings of the Modules team. label Dec 17, 2019
Copy link
Contributor

@MylesBorins MylesBorins left a comment

Choose a reason for hiding this comment

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

RSLGTM if tests are green

@nodejs-github-bot
Copy link
Collaborator

@ljharb
Copy link
Member

ljharb commented Dec 17, 2019

Should #31009 land before this does?

@guybedford
Copy link
Contributor Author

That would probably be slightly preferable, although they could land in either order, so long as the bug fix lands before the unflagging is released.

@MylesBorins MylesBorins added the esm Issues and PRs related to the ECMAScript Modules implementation. label Dec 23, 2019
@MylesBorins
Copy link
Contributor

I think we should land behavior changes before unflagging

@BridgeAR BridgeAR added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. blocked PRs that are blocked by other issues or PRs. labels Dec 24, 2019
@guybedford guybedford added blocked PRs that are blocked by other issues or PRs. and removed blocked PRs that are blocked by other issues or PRs. labels Dec 29, 2019
@guybedford
Copy link
Contributor Author

The behaviour changes have landed in 8a96d05, so this is in theory ready to go now.

@guybedford guybedford added pending and removed blocked PRs that are blocked by other issues or PRs. labels Dec 29, 2019
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
src/module_wrap.cc Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Dec 30, 2019

Codecov Report

Merging #31002 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #31002   +/-   ##
=======================================
  Coverage   97.33%   97.33%           
=======================================
  Files         189      189           
  Lines       63888    63888           
=======================================
  Hits        62184    62184           
  Misses       1704     1704

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a96d05...514a61d. Read the comment docs.

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if the modules team is good with it.

Copy link
Contributor

@jkrems jkrems left a comment

Choose a reason for hiding this comment

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

LGTM but I think there's an orphaned file that could be deleted.

test/es-module/test-esm-exports.mjs Show resolved Hide resolved
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jan 2, 2020

@BridgeAR BridgeAR removed the pending label Jan 2, 2020
BridgeAR pushed a commit that referenced this pull request Jan 2, 2020
PR-URL: #31002
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR
Copy link
Member

BridgeAR commented Jan 2, 2020

Landed in c7f328f 🎉

@BridgeAR BridgeAR closed this Jan 2, 2020
BridgeAR pushed a commit that referenced this pull request Jan 3, 2020
PR-URL: #31002
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR BridgeAR mentioned this pull request Jan 7, 2020
@MylesBorins MylesBorins removed the modules-agenda Issues and PRs to discuss during the meetings of the Modules team. label Jan 8, 2020
MylesBorins pushed a commit that referenced this pull request Jan 12, 2020
PR-URL: #31002
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
PR-URL: #31002
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
dmail pushed a commit to jsenv/importmap-node-module that referenced this pull request Jul 17, 2020
This major release is mostly about keeping import map for node module and writing importmap file separated.

- replace generateImportMapForProjectPackage by getImportMapFromNodeModules
- getImportMapFromNodeModules only return importmap, it does not write to filesystem anymore.
- add getImportMapFromFile
- add generateImportMapForProject
- generate importmap for package self ref by default
see nodejs/node#31002
- rename some parameter like favoredExports becoming packagesExportsPreference
- ensure a package self reference is stronger than self dev dependency
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. c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants