#!/usr/bin/env node --disable-warning=ExperimentalWarning //===----------------------------------------------------------------------===// // // This source file is part of the Swift open source project // // Copyright (c) 2025 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// const { readFile } = require('node:fs/promises'); const { WASI } = require('node:wasi'); const { argv, env } = require('node:process'); const wasmFile = argv[2]; const wasi = new WASI({ version: 'preview1', args: argv.splice(2), env, preopens: { }, }); (async () => { const wasm = await WebAssembly.compile( await readFile(wasmFile) ); const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject()); wasi.start(instance); })();