Skip to content

Commit

Permalink
fix(node:fs): default export for node:fs/promises
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 8, 2023
1 parent ced9db2 commit 37fd173
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/runtime/node/fs/_fs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type fs from "node:fs";
import { notImplemented } from "../../_internal/utils";
import * as fsp from "./promises";
import * as fsp from "./promises/_promises";

interface Promisifiable {
(): any;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/node/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as _classes from "./_classes";
import * as _constants from "./_constants";
import * as _fs from "./_fs";

import * as _promises from "./promises/index";
import * as _promises from "./promises/_promises";

export * from "./_classes";
export * from "./_constants";
Expand Down
38 changes: 38 additions & 0 deletions src/runtime/node/fs/promises/_promises.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type fsp from "node:fs/promises";
import { notImplemented } from "../../../_internal/utils";

export { constants } from "../_constants";

export const access: typeof fsp.access = notImplemented("fs.access");
export const copyFile: typeof fsp.copyFile = notImplemented("fs.copyFile");
export const cp: typeof fsp.cp = notImplemented("fs.cp");
export const open: typeof fsp.open = notImplemented("fs.open");
export const opendir: typeof fsp.opendir = notImplemented("fs.opendir");
export const rename: typeof fsp.rename = notImplemented("fs.rename");
export const truncate: typeof fsp.truncate = notImplemented("fs.truncate");
export const rm: typeof fsp.rm = notImplemented("fs.rm");
export const rmdir: typeof fsp.rmdir = notImplemented("fs.rmdir");
export const mkdir: typeof fsp.mkdir = notImplemented("fs.mkdir");
export const readdir: typeof fsp.readdir = notImplemented("fs.readdir");
export const readlink: typeof fsp.readlink = notImplemented("fs.readlink");
export const symlink: typeof fsp.symlink = notImplemented("fs.symlink");
export const lstat: typeof fsp.lstat = notImplemented("fs.lstat");
export const stat: typeof fsp.stat = notImplemented("fs.stat");
export const link: typeof fsp.link = notImplemented("fs.link");
export const unlink: typeof fsp.unlink = notImplemented("fs.unlink");
export const chmod: typeof fsp.chmod = notImplemented("fs.chmod");
export const lchmod: typeof fsp.lchmod = notImplemented("fs.lchmod");
export const lchown: typeof fsp.lchown = notImplemented("fs.lchown");
export const chown: typeof fsp.chown = notImplemented("fs.chown");
export const utimes: typeof fsp.utimes = notImplemented("fs.utimes");
export const lutimes: typeof fsp.lutimes = notImplemented("fs.lutimes");
export const realpath: typeof fsp.realpath = notImplemented("fs.realpath");
export const mkdtemp: typeof fsp.mkdtemp = notImplemented("fs.mkdtemp");
export const writeFile: typeof fsp.writeFile = notImplemented("fs.writeFile");
export const appendFile: typeof fsp.appendFile =
notImplemented("fs.appendFile");
export const readFile: typeof fsp.readFile = notImplemented("fs.readFile");
export const watch: typeof fsp.watch = notImplemented("fs.watch");
export const statfs: typeof fsp.statfs = notImplemented("fs.statfs");

export default <typeof fsp>{};
37 changes: 4 additions & 33 deletions src/runtime/node/fs/promises/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
import type fsp from "node:fs/promises";
import { notImplemented } from "../../../_internal/utils";

export { constants } from "../_constants";
import * as _promises from "./_promises";

export const access: typeof fsp.access = notImplemented("fs.access");
export const copyFile: typeof fsp.copyFile = notImplemented("fs.copyFile");
export const cp: typeof fsp.cp = notImplemented("fs.cp");
export const open: typeof fsp.open = notImplemented("fs.open");
export const opendir: typeof fsp.opendir = notImplemented("fs.opendir");
export const rename: typeof fsp.rename = notImplemented("fs.rename");
export const truncate: typeof fsp.truncate = notImplemented("fs.truncate");
export const rm: typeof fsp.rm = notImplemented("fs.rm");
export const rmdir: typeof fsp.rmdir = notImplemented("fs.rmdir");
export const mkdir: typeof fsp.mkdir = notImplemented("fs.mkdir");
export const readdir: typeof fsp.readdir = notImplemented("fs.readdir");
export const readlink: typeof fsp.readlink = notImplemented("fs.readlink");
export const symlink: typeof fsp.symlink = notImplemented("fs.symlink");
export const lstat: typeof fsp.lstat = notImplemented("fs.lstat");
export const stat: typeof fsp.stat = notImplemented("fs.stat");
export const link: typeof fsp.link = notImplemented("fs.link");
export const unlink: typeof fsp.unlink = notImplemented("fs.unlink");
export const chmod: typeof fsp.chmod = notImplemented("fs.chmod");
export const lchmod: typeof fsp.lchmod = notImplemented("fs.lchmod");
export const lchown: typeof fsp.lchown = notImplemented("fs.lchown");
export const chown: typeof fsp.chown = notImplemented("fs.chown");
export const utimes: typeof fsp.utimes = notImplemented("fs.utimes");
export const lutimes: typeof fsp.lutimes = notImplemented("fs.lutimes");
export const realpath: typeof fsp.realpath = notImplemented("fs.realpath");
export const mkdtemp: typeof fsp.mkdtemp = notImplemented("fs.mkdtemp");
export const writeFile: typeof fsp.writeFile = notImplemented("fs.writeFile");
export const appendFile: typeof fsp.appendFile =
notImplemented("fs.appendFile");
export const readFile: typeof fsp.readFile = notImplemented("fs.readFile");
export const watch: typeof fsp.watch = notImplemented("fs.watch");
export const statfs: typeof fsp.statfs = notImplemented("fs.statfs");
export default <typeof fsp>{
..._promises,
};

0 comments on commit 37fd173

Please sign in to comment.