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

fs: add fs/promises alias module #31553

Merged
merged 1 commit into from
Feb 19, 2020

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Jan 28, 2020

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

@devsnek devsnek requested review from ljharb, MylesBorins, cjihrig and a team January 28, 2020 16:34
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Jan 28, 2020
@devsnek devsnek 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
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

lib/fs/promises.js Outdated Show resolved Hide resolved
@ljharb
Copy link
Member

ljharb commented Jan 28, 2020

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.

@devsnek
Copy link
Member Author

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

ljharb commented Jan 28, 2020

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

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

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?

@devsnek devsnek 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
Member Author

devsnek commented Jan 30, 2020

ping @jasnell

@nodejs-github-bot
Copy link
Collaborator

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 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-Boss ExE-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
@addaleax addaleax mentioned this pull request Jun 27, 2020
4 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. notable-change PRs with changes that should be highlighted in changelogs. semver-major PRs 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