From 74a4d1284c8ff887fc8f232758ddd672943ba07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 12 Mar 2026 18:28:09 +0100 Subject: [PATCH 1/2] fix(ext/node): remove extra properties from node:fs exports Remove properties from node:fs default and named exports that Node.js does not export: - 18 flag constants (F_OK, R_OK, W_OK, X_OK, O_*) that should only be available via fs.constants - watchPromise, readFilePromise, readlinkPromise internal helpers - statPromise, realpathPromise, statfsPromise (duplicated in promises.ts) Co-Authored-By: Claude Opus 4.6 --- ext/node/polyfills/fs.ts | 88 ---------------------------------------- 1 file changed, 88 deletions(-) diff --git a/ext/node/polyfills/fs.ts b/ext/node/polyfills/fs.ts index d3b26d6762d178..4ad78bdb3d00d6 100644 --- a/ext/node/polyfills/fs.ts +++ b/ext/node/polyfills/fs.ts @@ -155,26 +155,6 @@ const { Uint8Array, } = primordials; -const { - F_OK, - R_OK, - W_OK, - X_OK, - O_RDONLY, - O_WRONLY, - O_RDWR, - O_NOCTTY, - O_TRUNC, - O_APPEND, - O_DIRECTORY, - O_NOFOLLOW, - O_SYNC, - O_DSYNC, - O_SYMLINK, - O_NONBLOCK, - O_CREAT, - O_EXCL, -} = constants; // -- stat -- @@ -233,18 +213,6 @@ function stat( ); } -const statPromise = promisify(stat) as ( - & ((path: string | Buffer | URL) => Promise) - & (( - path: string | Buffer | URL, - options: { bigint: false }, - ) => Promise) - & (( - path: string | Buffer | URL, - options: { bigint: true }, - ) => Promise) -); - function statSync(path: string | Buffer | URL): Stats; function statSync( path: string | Buffer | URL, @@ -336,11 +304,6 @@ function realpath( realpath.native = realpath; -const realpathPromise = promisify(realpath) as ( - path: string | Buffer, - options?: RealpathOptions, -) => Promise; - function realpathSync( path: string, options?: RealpathOptions | RealpathEncoding, @@ -641,17 +604,6 @@ function statfsSync( } } -const statfsPromise = promisify(statfs) as ( - & (( - path: string | Buffer | URL, - options?: { bigint?: false }, - ) => Promise>) - & (( - path: string | Buffer | URL, - options: { bigint: true }, - ) => Promise>) -); - function access( path: string | Buffer | URL, mode: number | CallbackWithError, @@ -3036,7 +2988,6 @@ export default { Dirent, exists, existsSync, - F_OK, fchmod, fchmodSync, fchown, @@ -3067,20 +3018,6 @@ export default { mkdirSync, mkdtemp, mkdtempSync, - O_APPEND, - O_CREAT, - O_DIRECTORY, - O_DSYNC, - O_EXCL, - O_NOCTTY, - O_NOFOLLOW, - O_NONBLOCK, - O_RDONLY, - O_RDWR, - O_SYMLINK, - O_SYNC, - O_TRUNC, - O_WRONLY, open, openAsBlob, openSync, @@ -3089,7 +3026,6 @@ export default { read, readSync, promises, - R_OK, readdir, readdirSync, readFile, @@ -3121,10 +3057,8 @@ export default { unwatchFile, utimes, utimesSync, - W_OK, watch, watchFile, - watchPromise, write, writeFile, writev, @@ -3132,7 +3066,6 @@ export default { writeFileSync, WriteStream, writeSync, - X_OK, // For tests _toUnixTimestamp, }; @@ -3167,7 +3100,6 @@ export { Dirent, exists, existsSync, - F_OK, fchmod, fchmodSync, fchown, @@ -3198,27 +3130,12 @@ export { mkdirSync, mkdtemp, mkdtempSync, - O_APPEND, - O_CREAT, - O_DIRECTORY, - O_DSYNC, - O_EXCL, - O_NOCTTY, - O_NOFOLLOW, - O_NONBLOCK, - O_RDONLY, - O_RDWR, - O_SYMLINK, - O_SYNC, - O_TRUNC, - O_WRONLY, open, openAsBlob, opendir, opendirSync, openSync, promises, - R_OK, read, readdir, readdirSync, @@ -3232,7 +3149,6 @@ export { readvPromise, readvSync, realpath, - realpathPromise, realpathSync, rename, renameSync, @@ -3242,9 +3158,7 @@ export { rmSync, stat, statfs, - statfsPromise, statfsSync, - statPromise, Stats, statSync, symlink, @@ -3256,7 +3170,6 @@ export { unwatchFile, utimes, utimesSync, - W_OK, watch, watchFile, watchPromise, @@ -3267,5 +3180,4 @@ export { writeSync, writev, writevSync, - X_OK, }; From 3ced6202b58f6a072dd5cde73007c4c224ea4c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 12 Mar 2026 18:34:54 +0100 Subject: [PATCH 2/2] fmt --- ext/node/polyfills/fs.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/node/polyfills/fs.ts b/ext/node/polyfills/fs.ts index 4ad78bdb3d00d6..762c54f555431b 100644 --- a/ext/node/polyfills/fs.ts +++ b/ext/node/polyfills/fs.ts @@ -155,7 +155,6 @@ const { Uint8Array, } = primordials; - // -- stat -- import {