Skip to content

Commit 92ca1fe

Browse files
bartlomiejuclaude
andauthored
fix(ext/node): remove extra properties from node:fs exports (#32670)
## Summary - Remove 18 flag constants (`F_OK`, `R_OK`, `W_OK`, `X_OK`, `O_RDONLY`, `O_WRONLY`, etc.) from `node:fs` default and named exports — Node.js only exposes these via `fs.constants`, not as top-level properties - Remove internal promise helpers (`watchPromise`, `readFilePromise`, `readlinkPromise`) from the default export object - Remove `statPromise`, `realpathPromise`, `statfsPromise` from named exports (already defined locally in `promises.ts`) After this change, `Object.keys(require("node:fs"))` in Deno matches Node.js except for 4 not-yet-implemented features (`FileReadStream`, `FileWriteStream`, `Utf8Stream`, `mkdtempDisposableSync`). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1ea5ff0 commit 92ca1fe

File tree

1 file changed

+0
-89
lines changed

1 file changed

+0
-89
lines changed

ext/node/polyfills/fs.ts

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,6 @@ const {
155155
Uint8Array,
156156
} = primordials;
157157

158-
const {
159-
F_OK,
160-
R_OK,
161-
W_OK,
162-
X_OK,
163-
O_RDONLY,
164-
O_WRONLY,
165-
O_RDWR,
166-
O_NOCTTY,
167-
O_TRUNC,
168-
O_APPEND,
169-
O_DIRECTORY,
170-
O_NOFOLLOW,
171-
O_SYNC,
172-
O_DSYNC,
173-
O_SYMLINK,
174-
O_NONBLOCK,
175-
O_CREAT,
176-
O_EXCL,
177-
} = constants;
178-
179158
// -- stat --
180159

181160
import {
@@ -233,18 +212,6 @@ function stat(
233212
);
234213
}
235214

236-
const statPromise = promisify(stat) as (
237-
& ((path: string | Buffer | URL) => Promise<Stats>)
238-
& ((
239-
path: string | Buffer | URL,
240-
options: { bigint: false },
241-
) => Promise<Stats>)
242-
& ((
243-
path: string | Buffer | URL,
244-
options: { bigint: true },
245-
) => Promise<BigIntStats>)
246-
);
247-
248215
function statSync(path: string | Buffer | URL): Stats;
249216
function statSync(
250217
path: string | Buffer | URL,
@@ -336,11 +303,6 @@ function realpath(
336303

337304
realpath.native = realpath;
338305

339-
const realpathPromise = promisify(realpath) as (
340-
path: string | Buffer,
341-
options?: RealpathOptions,
342-
) => Promise<string | Buffer>;
343-
344306
function realpathSync(
345307
path: string,
346308
options?: RealpathOptions | RealpathEncoding,
@@ -641,17 +603,6 @@ function statfsSync(
641603
}
642604
}
643605

644-
const statfsPromise = promisify(statfs) as (
645-
& ((
646-
path: string | Buffer | URL,
647-
options?: { bigint?: false },
648-
) => Promise<StatFs<number>>)
649-
& ((
650-
path: string | Buffer | URL,
651-
options: { bigint: true },
652-
) => Promise<StatFs<bigint>>)
653-
);
654-
655606
function access(
656607
path: string | Buffer | URL,
657608
mode: number | CallbackWithError,
@@ -3036,7 +2987,6 @@ export default {
30362987
Dirent,
30372988
exists,
30382989
existsSync,
3039-
F_OK,
30402990
fchmod,
30412991
fchmodSync,
30422992
fchown,
@@ -3067,20 +3017,6 @@ export default {
30673017
mkdirSync,
30683018
mkdtemp,
30693019
mkdtempSync,
3070-
O_APPEND,
3071-
O_CREAT,
3072-
O_DIRECTORY,
3073-
O_DSYNC,
3074-
O_EXCL,
3075-
O_NOCTTY,
3076-
O_NOFOLLOW,
3077-
O_NONBLOCK,
3078-
O_RDONLY,
3079-
O_RDWR,
3080-
O_SYMLINK,
3081-
O_SYNC,
3082-
O_TRUNC,
3083-
O_WRONLY,
30843020
open,
30853021
openAsBlob,
30863022
openSync,
@@ -3089,7 +3025,6 @@ export default {
30893025
read,
30903026
readSync,
30913027
promises,
3092-
R_OK,
30933028
readdir,
30943029
readdirSync,
30953030
readFile,
@@ -3121,18 +3056,15 @@ export default {
31213056
unwatchFile,
31223057
utimes,
31233058
utimesSync,
3124-
W_OK,
31253059
watch,
31263060
watchFile,
3127-
watchPromise,
31283061
write,
31293062
writeFile,
31303063
writev,
31313064
writevSync,
31323065
writeFileSync,
31333066
WriteStream,
31343067
writeSync,
3135-
X_OK,
31363068
// For tests
31373069
_toUnixTimestamp,
31383070
};
@@ -3167,7 +3099,6 @@ export {
31673099
Dirent,
31683100
exists,
31693101
existsSync,
3170-
F_OK,
31713102
fchmod,
31723103
fchmodSync,
31733104
fchown,
@@ -3198,27 +3129,12 @@ export {
31983129
mkdirSync,
31993130
mkdtemp,
32003131
mkdtempSync,
3201-
O_APPEND,
3202-
O_CREAT,
3203-
O_DIRECTORY,
3204-
O_DSYNC,
3205-
O_EXCL,
3206-
O_NOCTTY,
3207-
O_NOFOLLOW,
3208-
O_NONBLOCK,
3209-
O_RDONLY,
3210-
O_RDWR,
3211-
O_SYMLINK,
3212-
O_SYNC,
3213-
O_TRUNC,
3214-
O_WRONLY,
32153132
open,
32163133
openAsBlob,
32173134
opendir,
32183135
opendirSync,
32193136
openSync,
32203137
promises,
3221-
R_OK,
32223138
read,
32233139
readdir,
32243140
readdirSync,
@@ -3232,7 +3148,6 @@ export {
32323148
readvPromise,
32333149
readvSync,
32343150
realpath,
3235-
realpathPromise,
32363151
realpathSync,
32373152
rename,
32383153
renameSync,
@@ -3242,9 +3157,7 @@ export {
32423157
rmSync,
32433158
stat,
32443159
statfs,
3245-
statfsPromise,
32463160
statfsSync,
3247-
statPromise,
32483161
Stats,
32493162
statSync,
32503163
symlink,
@@ -3256,7 +3169,6 @@ export {
32563169
unwatchFile,
32573170
utimes,
32583171
utimesSync,
3259-
W_OK,
32603172
watch,
32613173
watchFile,
32623174
watchPromise,
@@ -3267,5 +3179,4 @@ export {
32673179
writeSync,
32683180
writev,
32693181
writevSync,
3270-
X_OK,
32713182
};

0 commit comments

Comments
 (0)