Skip to content

Deno 2 WASI support #95

Open
Open
@G4Vi

Description

@G4Vi

Deno removed wasi from their standard library, we should use the wasi polyfill instead on Deno 2.

From https://discord.com/channels/1011124058408112148/1156304630028959824/1295444183930110013:

main.ts

import createPlugin from "npm:@extism/extism";

const plugin = await createPlugin(
  "plugin.wasm",
  { useWasi: true, runInWorker: true },
);

let out = await plugin.call("greet", "a1");
console.log(out?.text());

lib.rs (compiled to wasm32-wasi w/ release)

use extism_pdk::*;

#[plugin_fn]
pub fn greet(name: String) -> FnResult<String> {
    Ok(format!("Hello, {}!", name))
}

result:

Uncaught (in worker "") Relative import path "wasi" not prefixed with / or ./ or ../ and not in import map from "data:text/javascript;base64,dm...lots of base64...

hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:wasi").

at data:text/javascript;base64,dm...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions