Skip to content

Conversation

@devsnek
Copy link
Member

This restores fs/promises in node core. It can't be overridden by a file on disk in a version of node that has it. It will fail to load on a version of node that doesn't have it because the fs module on npm is locked. It is not a new core module, it is a child of the fs module, so the concern about namespacing shouldn't apply.

Fixes#21014

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

@devsnekdevsnek requested review from a team, MylesBorins, cjihrig and ljharbJanuary 28, 2020 16:34
@nodejs-github-botnodejs-github-bot added the build Issues and PRs related to build files or the CI. label Jan 28, 2020
@devsnekdevsnek added fs Issues and PRs related to the fs subsystem / file system. and removed build Issues and PRs related to build files or the CI. labels Jan 28, 2020
@devsnekdevsnekforce-pushed the restore-fs-slash-promises branch from 1db0897 to aff5f29CompareJanuary 28, 2020 16:41
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@ljharb
Copy link
Member

The concern applies because fs had no “children” before, and things like resolve identify core modules by the full name, not just the first segment. I expect CIGTM to fail with this change.

@devsnekdevsnekforce-pushed the restore-fs-slash-promises branch from aff5f29 to 8890701CompareJanuary 28, 2020 17:08
@devsnek
Copy link
MemberAuthor

devsnek commented Jan 28, 2020

@ljharb it seems resolve already has an entry for it, and the v8/tools entries appear to support disjoint version matching, so I think resolve should be able to be fixed pretty easily.

The namespacing concern is from adding new things that occupy space in global registries such as npm, not about breaking modules that have a list of all the things you can successfully require in node.

@ljharb
Copy link
Member

It does, due to 10.0.0, that is true, and yes, i can easily add the next version - but it will be marked as a non-core module until users update to the latest version of resolve.

@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@MylesBorinsMylesBorins left a comment

Choose a reason for hiding this comment

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

LGTM

simple and elegant!

@MylesBorins
Copy link
Contributor

I'd like to see @jasnell sign-off on this as I believe he was one of the folks who identified earlier security concerns. To be clear I'm extremely happy to see this land!

@MylesBorins
Copy link
Contributor

Should this be semver-minor?

@devsnekdevsnek added the semver-minor PRs that contain new features and should be released in the next minor version. label Jan 29, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@devsnek
Copy link
MemberAuthor

ping @jasnell

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@TrottTrott 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'm inclined to run CITGM in case of unforeseen consequences?

@Trott
Copy link
Member

Trott commented Jan 31, 2020

Should there be a test that does something like this?:

assert.strictEqual(require('fs/promises'),require('fs').promises)

Otherwise, I don't think we're testing CommonJS require('fs/promises') anywhere?

ExE-Boss added a commit to ExE-Boss/node that referenced this pull request Jun 21, 2020
jasnell pushed a commit that referenced this pull request Jun 25, 2020
Refs: #31553 Refs: #32953 PR-URL: #34001 Refs: #34002 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
@ExE-BossExE-Boss mentioned this pull request Jun 25, 2020
4 tasks
ExE-Boss added a commit to ExE-Boss/node that referenced this pull request Jun 27, 2020
@addaleaxaddaleax mentioned this pull request Jun 27, 2020
4 tasks
@richardlaurichardlau mentioned this pull request Jul 16, 2020
2 tasks
ExE-Boss added a commit to ExE-Boss/node that referenced this pull request Oct 6, 2020
nodejs-github-bot pushed a commit that referenced this pull request Oct 20, 2020
Refs: #31553 Refs: #32953 Refs: #33950 Refs: #34001 Refs: #34002 Refs: #34055 PR-URL: #34962 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
aduh95 pushed a commit that referenced this pull request Oct 20, 2020
Refs: #31553 Refs: #32953 Refs: #33950 Refs: #34001 Refs: #34002 PR-URL: #34055 Refs: #34962 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
ExE-Boss added a commit to ExE-Boss/node that referenced this pull request Oct 24, 2020
Fixes: nodejs#35740 Refs: nodejs#31553 Refs: nodejs#32953 Refs: nodejs#33991 Refs: nodejs#34001 Refs: nodejs#34055 Refs: nodejs#34962 Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Trivikram Kamat <[email protected]> Co-authored-by: Rich Trott <[email protected]>
nodejs-github-bot pushed a commit that referenced this pull request Oct 25, 2020
Fixes: #35740 Refs: #31553 Refs: #32953 Refs: #33991 Refs: #34001 Refs: #34055 Refs: #34962 Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Trivikram Kamat <[email protected]> Co-authored-by: Rich Trott <[email protected]> PR-URL: #34002 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Pranshu Srivastava <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Nov 3, 2020
Fixes: #35740 Refs: #31553 Refs: #32953 Refs: #33991 Refs: #34001 Refs: #34055 Refs: #34962 Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Trivikram Kamat <[email protected]> Co-authored-by: Rich Trott <[email protected]> PR-URL: #34002 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Pranshu Srivastava <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
codebytere pushed a commit that referenced this pull request Nov 22, 2020
Refs: #31553 Refs: #32953 Refs: #33950 Refs: #34001 Refs: #34002 Refs: #34055 PR-URL: #34962 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
codebytere pushed a commit that referenced this pull request Nov 22, 2020
Refs: #31553 Refs: #32953 Refs: #33950 Refs: #34001 Refs: #34002 PR-URL: #34055 Refs: #34962 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
targos pushed a commit that referenced this pull request May 16, 2021
Fixes: #35740 Refs: #31553 Refs: #32953 Refs: #33991 Refs: #34001 Refs: #34055 Refs: #34962 Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Trivikram Kamat <[email protected]> Co-authored-by: Rich Trott <[email protected]> PR-URL: #34002 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Pranshu Srivastava <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Jun 11, 2021
Fixes: #35740 Refs: #31553 Refs: #32953 Refs: #33991 Refs: #34001 Refs: #34055 Refs: #34962 Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Trivikram Kamat <[email protected]> Co-authored-by: Rich Trott <[email protected]> PR-URL: #34002 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Pranshu Srivastava <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fsIssues and PRs related to the fs subsystem / file system.notable-changePRs with changes that should be highlighted in changelogs.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can’t import fs Promises API with ECMAScript Modules

14 participants

@devsnek@ljharb@nodejs-github-bot@MylesBorins@Trott@jasnell@sauravhiremath@mcollina@lpinca@targos@cjihrig@tniessen@hiroppy@jamesgeorge007