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: enable subpath imports in REPL #43450

Merged
merged 2 commits into from
Jun 30, 2022
Merged

Conversation

rayw000
Copy link
Contributor

@rayw000 rayw000 commented Jun 16, 2022

Also enable subpath imports in REPL.

fix: #43410

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 16, 2022
@rayw000 rayw000 changed the title modules: enable subpath imports in REPL module: enable subpath imports in REPL Jun 16, 2022
Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

I think this is a good feature to have, but we shouldn't be duplicating the code.

Could the parent for the REPL context not just have a filename set to the CWD directory? I think something like that would be best for this code not to need to know about repl at all and instead for it to be a REPL feature entirely. Alternatively, if something like that on the REPL side isn't at all possible, at least use a temporary variable parentPath to not duplicate the code.

@rayw000
Copy link
Contributor Author

rayw000 commented Jun 17, 2022

Thank you @guybedford

I'm not quite clear about your parentPath. Could you explain it a little bit more?

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

Could you add a test that; s failing on main and passing with this PR please?

@rayw000
Copy link
Contributor Author

rayw000 commented Jun 17, 2022

Could you add a test that; s failing on main and passing with this PR please?

Sure. Done.

test/es-module/test-esm-repl-imports.js Outdated Show resolved Hide resolved
test/es-module/test-esm-repl-imports.js Outdated Show resolved Hide resolved
test/es-module/test-esm-repl-imports.js Outdated Show resolved Hide resolved
Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

I take it import() works correctly on the REPL for this same case?

@rayw000
Copy link
Contributor Author

rayw000 commented Jun 18, 2022

I take it import() works correctly on the REPL for this same case?

Yes, it works for import() too. I've added necessary test case to ensure this.

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

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 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. labels Jun 30, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 30, 2022
@nodejs-github-bot nodejs-github-bot merged commit c15a605 into nodejs:main Jun 30, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in c15a605

@rayw000 rayw000 deleted the fix-43410 branch July 1, 2022 03:15
targos pushed a commit that referenced this pull request Jul 12, 2022
PR-URL: #43450
Fixes: #43410
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
PR-URL: #43450
Fixes: #43410
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
PR-URL: nodejs/node#43450
Fixes: nodejs/node#43410
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subpath imports (require "#foo") do not work in REPL
6 participants