2020-09-21 08:26:41 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-08-27 05:21:57 -04:00
|
|
|
import Context from "./snapshot_preview1.ts";
|
|
|
|
|
|
|
|
const options = JSON.parse(Deno.args[0]);
|
|
|
|
const pathname = Deno.args[1];
|
|
|
|
const binary = await Deno.readFile(pathname);
|
|
|
|
const module = await WebAssembly.compile(binary);
|
|
|
|
|
|
|
|
const context = new Context({
|
|
|
|
env: options.env,
|
|
|
|
args: [pathname].concat(options.args),
|
|
|
|
preopens: options.preopens,
|
|
|
|
});
|
|
|
|
|
|
|
|
const instance = new WebAssembly.Instance(module, {
|
2020-09-29 05:41:22 -04:00
|
|
|
"wasi_snapshot_preview1": context.exports,
|
2020-08-27 05:21:57 -04:00
|
|
|
});
|
|
|
|
|
2020-11-02 12:50:45 -05:00
|
|
|
context.start(instance);
|