Skip to content

Commit

Permalink
re-export fs.promises.readFile
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jan 21, 2022
1 parent 3728610 commit cb8d461
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/ModuleLoader.ts
Expand Up @@ -253,7 +253,8 @@ export class ModuleLoader {
let source: LoadResult;
try {
source = await this.readQueue.run(
async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id))
async () =>
(await this.pluginDriver.hookFirst('load', [id])) ?? (await readFile(id, 'utf8'))
);
} catch (err: any) {
timeEnd('load modules', 3);
Expand Down
6 changes: 1 addition & 5 deletions src/utils/fs.ts
@@ -1,11 +1,7 @@
import { promises as fs } from 'fs';
import { dirname } from './path';

export const { lstat, readdir, realpath } = fs;

export function readFile(file: string): Promise<string> {
return fs.readFile(file, 'utf8');
}
export const { lstat, readdir, readFile, realpath } = fs;

async function mkdirpath(path: string): Promise<void> {
const dir = dirname(path);
Expand Down

0 comments on commit cb8d461

Please sign in to comment.