Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wasmer/wasi

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wasmer/wasi - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

dist/pkg/wasmer_wasi_js_bg.d.ts

2

dist/lib.d.ts
export * from "./pkg/wasmer_wasi_js";
export declare type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export declare const init: (input?: InitInput | Promise<InitInput>, force?: boolean) => Promise<void>;

@@ -9,21 +9,21 @@ /**

/**
* @returns {BigInt}
* @returns {bigint}
*/
lastAccessed(): BigInt;
lastAccessed(): bigint;
/**
* @returns {BigInt}
* @returns {bigint}
*/
lastModified(): BigInt;
lastModified(): bigint;
/**
* @returns {BigInt}
* @returns {bigint}
*/
createdTime(): BigInt;
createdTime(): bigint;
/**
* @returns {BigInt}
* @returns {bigint}
*/
size(): BigInt;
size(): bigint;
/**
* @param {BigInt} new_size
* @param {bigint} new_size
*/
setLength(new_size: BigInt): void;
setLength(new_size: bigint): void;
/**

@@ -60,2 +60,7 @@ * @returns {Uint8Array}

static __wrap(ptr: any): any;
/**
* @param {any} jso
* @returns {MemFS}
*/
static from_js(jso: any): MemFS;
__destroy_into_raw(): number;

@@ -177,2 +182,3 @@ ptr: number;

export default init;
declare function init(input: any): Promise<WebAssembly.Exports>;
export function initSync(module: any): any;
declare function init(input: any): Promise<any>;
{
"name": "@wasmer/wasi",
"version": "1.1.2",
"version": "1.2.0",
"main": "dist/Library.cjs.min.js",

@@ -5,0 +5,0 @@ "module": "dist/Library.esm.min.js",

@@ -135,4 +135,4 @@ # <img height="48" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo" valign="middle"> Wasmer JS [![Wasmer Slack Channel](https://img.shields.io/static/v1?label=chat&message=on%20Slack&color=green)](https://slack.wasmer.io)

* [wasm-pack][wasm-pack]
* [wabt][wabt] (for `wasm-opt`)
* [binaryen][binaryen] (for `wasm-strip`)
* [wabt][wabt] (for `wasm-strip`)
* [binaryen][binaryen] (for `wasm-opt`)

@@ -139,0 +139,0 @@ ```sh

@@ -135,4 +135,4 @@ # <img height="48" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo" valign="middle"> Wasmer JS [![Wasmer Slack Channel](https://img.shields.io/static/v1?label=chat&message=on%20Slack&color=green)](https://slack.wasmer.io)

* [wasm-pack][wasm-pack]
* [wabt][wabt] (for `wasm-opt`)
* [binaryen][binaryen] (for `wasm-strip`)
* [wabt][wabt] (for `wasm-strip`)
* [binaryen][binaryen] (for `wasm-opt`)

@@ -139,0 +139,0 @@ ```sh

const fs = require('fs');
// const { init, WASI } = require('../');
const { init, WASI } = require('../dist/Library.cjs.js');
const { init, WASI, MemFS } = require('../dist/Library.cjs.js');

@@ -81,3 +81,3 @@

test('wasi start empty fails', async() => {
test('wasi initialize with JS imports', async() => {
let moduleBytes = fs.readFileSync(__dirname + '/test.wasm');

@@ -87,3 +87,2 @@ let wasi = new WASI({});

let imports = wasi.getImports(module);
// console.log(imports);
let instance = await WebAssembly.instantiate(module, {

@@ -95,5 +94,36 @@ ...imports,

});
expect(() => wasi.start()).toThrow("You need to provide a instance as argument to start, or call `wasi.instantiate` with the `WebAssembly.Instance` manually");
let code = wasi.start(instance);
expect(code).toBe(0);
});
test('wasi initialize with JS imports with empty start', async() => {
let moduleBytes = fs.readFileSync(__dirname + '/test.wasm');
let wasi = new WASI({});
const module = await WebAssembly.compile(moduleBytes);
let imports = wasi.getImports(module);
let instance = await WebAssembly.instantiate(module, {
...imports,
'module': {
'external': function() { console.log("external: hello world!") }
}
});
expect(() => wasi.start()).toThrow("You need to provide an instance as argument to `start`, or call `wasi.instantiate` with the `WebAssembly.Instance` manually");
});
test('wasi fs config works', async() => {
let fs = new MemFS();
fs.createDir('/magic');
let wasi = new WASI({fs});
expect(wasi.fs.readDir('/').map(e => e.path)).toEqual(['/magic']);
});
test('mapdir with fs config works', async () => {
let wfs = new MemFS();
wfs.createDir('/magic');
let contents = fs.readFileSync(__dirname + '/mapdir.wasm');
let wasi = await initWasi(contents, {fs: wfs});
let code = wasi.start();
expect(wasi.getStdoutString()).toBe(`"./magic"\n`);
});
test('get imports', async() => {

@@ -115,2 +145,4 @@ let moduleBytes = fs.readFileSync(__dirname + '/test.wasm');

expect(exitCode).toBe(0);
// This should print "hello world (exit code: 0)"

@@ -117,0 +149,0 @@ console.log(`${stdout}(exit code: ${exitCode})`);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc