
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@vscode/wasm-wasi
Advanced tools
This npm module implements an API facade for the WASM WASI Core VS Code extension.
With release version 0.11.0
the implementation details of the WASM support for VS Code has changed. This npm module is now a facade around the wasm-wasi-core
VS Code extension.
The source code of the example can be found here
First we need to define a package.json
for the extension that wants to execute a WASM process:
{
"name": "...",
...
// depend on the wasm-wasi-core extension
"extensionDependencies": [
"ms-vscode.wasm-wasi-core"
],
// Depend on the wasm-wasi facade npm module to get easier API access to the
// core extension.
"dependencies": {
"@vscode/wasm-wasi": "..."
},
}
The actual source code to execute a WASM process looks like this
// Load the WASM API
const wasm: Wasm = await Wasm.api();
// Create a pseudoterminal to provide stdio to the WASM process.
const pty = wasm.createPseudoterminal();
const terminal = window.createTerminal({ name: 'Run C Example', pty, isTransient: true });
terminal.show(true);
// Load the WASM module. It is stored alongside the extension JS code.
// So we can use VS Code's file system API to load it. Makes it
// independent of whether the code runs in the desktop or the web.
try {
const bits = await workspace.fs.readFile(Uri.joinPath(context.extensionUri, 'hello.wasm'));
const module = await WebAssembly.compile(bits);
// Create a WASM process.
const process = await wasm.createProcess('hello', module, { stdio: pty.stdio });
// Run the process and wait for its result.
const result = await process.run();
} catch (error) {
// Show an error message if something goes wrong.
void window.showErrorMessage(error.message);
}
FAQs
An API facade for the WASM WASI CORE VS Code extension
The npm package @vscode/wasm-wasi receives a total of 91 weekly downloads. As such, @vscode/wasm-wasi popularity was classified as not popular.
We found that @vscode/wasm-wasi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.