// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
import * as t from "../types.js";
import { runtimes } from "../wit.js";
import { Runtime } from "./mod.js";
import { fx } from "../index.js";
export class WasmEdgeRuntime extends Runtime {
    constructor() {
        super(runtimes.registerWasmedgeRuntime());
    }
    wasi(inp, out, { func, wasm, effect = fx.read() }) {
        const matId = runtimes.fromWasiModule({
            runtime: this._id,
            effect,
        }, {
            module: `file:${wasm}`,
            funcName: func,
        });
        return t.func(inp, out, {
            _id: matId,
            effect,
            module: wasm,
            funcMame: func,
        });
    }
}
