Skip to content

Commit 7adb986

Browse files
npm run format
1 parent 962915d commit 7adb986

File tree

6 files changed

+203
-186
lines changed

6 files changed

+203
-186
lines changed

src/features/all.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { useMemoryFS } from "./fd.js";
77
import { useProc } from "./proc.js";
88
import { useRandom } from "./random.js";
99

10-
type Options = Parameters<typeof useMemoryFS>[0] & Parameters<typeof useRandom>[0];
10+
type Options = Parameters<typeof useMemoryFS>[0] &
11+
Parameters<typeof useRandom>[0];
1112

1213
export function useAll(useOptions: Options = {}): WASIFeatureProvider {
1314
return (options: WASIOptions, abi: WASIAbi, memoryView: () => DataView) => {

src/features/fd.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,8 @@ export function useMemoryFS(
846846
const path = abi.readString(view, pathPtr, pathLen);
847847

848848
const guestPath = normalizePath(
849-
(dirEntry.path.endsWith("/") ? dirEntry.path : dirEntry.path + "/") + path,
849+
(dirEntry.path.endsWith("/") ? dirEntry.path : dirEntry.path + "/") +
850+
path,
850851
);
851852

852853
const existing = getFileFromPath(guestPath);
@@ -858,13 +859,15 @@ export function useMemoryFS(
858859
let target = fileSystem.resolve(dirEntry.node as DirectoryNode, path);
859860

860861
if (target) {
861-
if (oflags & WASIAbi.WASI_OFLAGS_EXCL) return WASIAbi.WASI_ERRNO_EXIST;
862+
if (oflags & WASIAbi.WASI_OFLAGS_EXCL)
863+
return WASIAbi.WASI_ERRNO_EXIST;
862864
if (oflags & WASIAbi.WASI_OFLAGS_TRUNC) {
863865
if (target.type !== "file") return WASIAbi.WASI_ERRNO_INVAL;
864866
(target as FileNode).content = new Uint8Array(0);
865867
}
866868
} else {
867-
if (!(oflags & WASIAbi.WASI_OFLAGS_CREAT)) return WASIAbi.WASI_ERRNO_NOENT;
869+
if (!(oflags & WASIAbi.WASI_OFLAGS_CREAT))
870+
return WASIAbi.WASI_ERRNO_NOENT;
868871
target = fileSystem.createFileIn(
869872
dirEntry.node as DirectoryNode,
870873
path,

src/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ export * from "./features/all.js";
66
export * from "./features/args.js";
77
export * from "./features/clock.js";
88
export * from "./features/environ.js";
9-
export { useFS, useStdio, useMemoryFS, MemoryFileSystem } from "./features/fd.js";
9+
export {
10+
useFS,
11+
useStdio,
12+
useMemoryFS,
13+
MemoryFileSystem,
14+
} from "./features/fd.js";
1015
export * from "./features/proc.js";
1116
export * from "./features/random.js";
1217
export * from "./features/tracing.js";

test/fd.test.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReadableTextProxy } from "../lib/esm/features/fd.js";
2-
import { describe, it } from 'node:test';
3-
import assert from 'node:assert';
2+
import { describe, it } from "node:test";
3+
import assert from "node:assert";
44

55
describe("fd.ReadableTextProxy", () => {
66
it("readv single buffer", () => {

test/wasi.skip.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@
4949
"pwrite-with-access": "fail",
5050
"pread-with-access": "fail"
5151
},
52-
"WASI AssemblyScript tests": {
53-
}
54-
}
52+
"WASI AssemblyScript tests": {}
53+
}

0 commit comments

Comments
 (0)