Skip to content

fs: add fs/promises alias module - #31553

Merged
devsnek merged 1 commit into
nodejs:masterfrom
devsnek:restore-fs-slash-promises
Feb 19, 2020
Merged

fs: add fs/promises alias module#31553
devsnek merged 1 commit into
nodejs:masterfrom
devsnek:restore-fs-slash-promises

Conversation

@devsnek

Copy link
Copy Markdown
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

@devsnek
devsnek 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
@devsnek
devsnekforce-pushed the restore-fs-slash-promises branch from 1db0897 to aff5f29CompareJanuary 28, 2020 16:41

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment threadlib/fs/promises.js Outdated
@ljharb

Copy link
Copy Markdown
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.

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

devsnek commented Jan 28, 2020

Copy link
Copy Markdown
MemberAuthor

@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
Copy Markdown
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
Copy Markdown
Collaborator

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

LGTM

simple and elegant!

@MylesBorins

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@devsnek

Copy link
Copy Markdown
MemberAuthor

ping @jasnell

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@TrottTrott left a comment

Copy link
Copy Markdown
Member

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

Trott commented Jan 31, 2020

Copy link
Copy Markdown
Member

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 <anna@addaleax.net>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@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 <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
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 <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
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 <duhamelantoine1995@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
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 <duhamelantoine1995@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
PR-URL: #34002
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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 <duhamelantoine1995@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
PR-URL: #34002
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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 <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
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 <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
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 <duhamelantoine1995@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
PR-URL: #34002
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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 <duhamelantoine1995@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
PR-URL: #34002
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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