Skip to content

Commit 74a4d12

Browse files
bartlomiejuclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 40b56f7 commit 74a4d12

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

ext/node/polyfills/fs.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +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;
178158

179159
// -- stat --
180160

@@ -233,18 +213,6 @@ function stat(
233213
);
234214
}
235215

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-
248216
function statSync(path: string | Buffer | URL): Stats;
249217
function statSync(
250218
path: string | Buffer | URL,
@@ -336,11 +304,6 @@ function realpath(
336304

337305
realpath.native = realpath;
338306

339-
const realpathPromise = promisify(realpath) as (
340-
path: string | Buffer,
341-
options?: RealpathOptions,
342-
) => Promise<string | Buffer>;
343-
344307
function realpathSync(
345308
path: string,
346309
options?: RealpathOptions | RealpathEncoding,
@@ -641,17 +604,6 @@ function statfsSync(
641604
}
642605
}
643606

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-
655607
function access(
656608
path: string | Buffer | URL,
657609
mode: number | CallbackWithError,
@@ -3036,7 +2988,6 @@ export default {
30362988
Dirent,
30372989
exists,
30382990
existsSync,
3039-
F_OK,
30402991
fchmod,
30412992
fchmodSync,
30422993
fchown,
@@ -3067,20 +3018,6 @@ export default {
30673018
mkdirSync,
30683019
mkdtemp,
30693020
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,
30843021
open,
30853022
openAsBlob,
30863023
openSync,
@@ -3089,7 +3026,6 @@ export default {
30893026
read,
30903027
readSync,
30913028
promises,
3092-
R_OK,
30933029
readdir,
30943030
readdirSync,
30953031
readFile,
@@ -3121,18 +3057,15 @@ export default {
31213057
unwatchFile,
31223058
utimes,
31233059
utimesSync,
3124-
W_OK,
31253060
watch,
31263061
watchFile,
3127-
watchPromise,
31283062
write,
31293063
writeFile,
31303064
writev,
31313065
writevSync,
31323066
writeFileSync,
31333067
WriteStream,
31343068
writeSync,
3135-
X_OK,
31363069
// For tests
31373070
_toUnixTimestamp,
31383071
};
@@ -3167,7 +3100,6 @@ export {
31673100
Dirent,
31683101
exists,
31693102
existsSync,
3170-
F_OK,
31713103
fchmod,
31723104
fchmodSync,
31733105
fchown,
@@ -3198,27 +3130,12 @@ export {
31983130
mkdirSync,
31993131
mkdtemp,
32003132
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,
32153133
open,
32163134
openAsBlob,
32173135
opendir,
32183136
opendirSync,
32193137
openSync,
32203138
promises,
3221-
R_OK,
32223139
read,
32233140
readdir,
32243141
readdirSync,
@@ -3232,7 +3149,6 @@ export {
32323149
readvPromise,
32333150
readvSync,
32343151
realpath,
3235-
realpathPromise,
32363152
realpathSync,
32373153
rename,
32383154
renameSync,
@@ -3242,9 +3158,7 @@ export {
32423158
rmSync,
32433159
stat,
32443160
statfs,
3245-
statfsPromise,
32463161
statfsSync,
3247-
statPromise,
32483162
Stats,
32493163
statSync,
32503164
symlink,
@@ -3256,7 +3170,6 @@ export {
32563170
unwatchFile,
32573171
utimes,
32583172
utimesSync,
3259-
W_OK,
32603173
watch,
32613174
watchFile,
32623175
watchPromise,
@@ -3267,5 +3180,4 @@ export {
32673180
writeSync,
32683181
writev,
32693182
writevSync,
3270-
X_OK,
32713183
};

0 commit comments

Comments
 (0)