Skip to content

Commit 9c99798

Browse files
authored
fix: export Volume class directly rather than as a const (#1099)
1 parent 2c6a6ca commit 9c99798

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎src/index.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Stats from './Stats';
22
import Dirent from './Dirent';
33
import {
4-
Volume as _Volume,
4+
Volume,
55
StatWatcher,
66
FSWatcher,
77
toUnixTimestamp,
@@ -16,13 +16,12 @@ import { fsSynchronousApiList } from './node/lists/fsSynchronousApiList';
1616
import { fsCallbackApiList } from './node/lists/fsCallbackApiList';
1717
const { F_OK, R_OK, W_OK, X_OK } = constants;
1818

19-
export { DirectoryJSON, NestedDirectoryJSON };
20-
export const Volume = _Volume;
19+
export { DirectoryJSON, NestedDirectoryJSON, Volume };
2120

2221
// Default volume.
23-
export const vol = new _Volume();
22+
export const vol = new Volume();
2423

25-
export interface IFs extends _Volume {
24+
export interface IFs extends Volume {
2625
constants: typeof constants;
2726
Stats: new (...args) => Stats;
2827
Dirent: new (...args) => Dirent;
@@ -34,7 +33,7 @@ export interface IFs extends _Volume {
3433
_toUnixTimestamp;
3534
}
3635

37-
export function createFsFromVolume(vol: _Volume): IFs {
36+
export function createFsFromVolume(vol: Volume): IFs {
3837
const fs = { F_OK, R_OK, W_OK, X_OK, constants, Stats, Dirent } as any as IFs;
3938

4039
// Bind FS methods.
@@ -65,13 +64,13 @@ export const fs: IFs = createFsFromVolume(vol);
6564
* @returns A `memfs` file system instance, which is a drop-in replacement for
6665
* the `fs` module.
6766
*/
68-
export const memfs = (json: NestedDirectoryJSON = {}, cwd: string = '/'): { fs: IFs; vol: _Volume } => {
67+
export const memfs = (json: NestedDirectoryJSON = {}, cwd: string = '/'): { fs: IFs; vol: Volume } => {
6968
const vol = Volume.fromNestedJSON(json, cwd);
7069
const fs = createFsFromVolume(vol);
7170
return { fs, vol };
7271
};
7372

74-
export type IFsWithVolume = IFs & { __vol: _Volume };
73+
export type IFsWithVolume = IFs & { __vol: Volume };
7574

7675
declare let module;
7776
module.exports = { ...module.exports, ...fs };

0 commit comments

Comments
 (0)