|
1 | | -import { WASIAbi } from "../abi"; |
2 | | -import { WASIFeatureProvider, WASIOptions } from "../options"; |
3 | | -import { useArgs } from "./args"; |
4 | | -import { useClock } from "./clock"; |
5 | | -import { useEnviron } from "./environ"; |
6 | | -import { useFS, useStdio } from "./fd"; |
7 | | -import { useProc } from "./proc"; |
8 | | -import { useRandom } from "./random"; |
| 1 | +import { WASIAbi } from "../abi.js"; |
| 2 | +import { WASIFeatureProvider, WASIOptions } from "../options.js"; |
| 3 | +import { useArgs } from "./args.js"; |
| 4 | +import { useClock } from "./clock.js"; |
| 5 | +import { useEnviron } from "./environ.js"; |
| 6 | +import { useMemoryFS } from "./fd.js"; |
| 7 | +import { useProc } from "./proc.js"; |
| 8 | +import { useRandom } from "./random.js"; |
9 | 9 |
|
10 | | -type Options = (Parameters<typeof useFS>[0] | Parameters<typeof useStdio>[0]) & |
11 | | - Parameters<typeof useRandom>[0]; |
| 10 | +type Options = Parameters<typeof useMemoryFS>[0] & Parameters<typeof useRandom>[0]; |
12 | 11 |
|
13 | 12 | export function useAll(useOptions: Options = {}): WASIFeatureProvider { |
14 | 13 | return (options: WASIOptions, abi: WASIAbi, memoryView: () => DataView) => { |
15 | 14 | const features = [ |
| 15 | + useMemoryFS(useOptions), |
16 | 16 | useEnviron, |
17 | 17 | useArgs, |
18 | 18 | useClock, |
19 | 19 | useProc, |
20 | 20 | useRandom(useOptions), |
21 | 21 | ]; |
22 | | - if ("fs" in useOptions) { |
23 | | - features.push(useFS({ fs: useOptions.fs })); |
24 | | - } else { |
25 | | - features.push(useStdio(useOptions)); |
26 | | - } |
27 | 22 | return features.reduce((acc, fn) => { |
28 | 23 | return { ...acc, ...fn(options, abi, memoryView) }; |
29 | 24 | }, {}); |
|
0 commit comments