import { pathToFileURL } from 'node:url'; import { join, resolve } from 'node:path'; // Usage: node run-wasm.mjs const root = resolve(process.argv[2]); try { const { dotnet } = await import(pathToFileURL(join(root, '_framework', 'dotnet.js')).href); const { runMain } = await dotnet.create(); const exitCode = await runMain(); process.exit(exitCode); } catch (error) { // Managed exceptions arrive with a huge JS stack, so print only the parts that say what went wrong. console.log('RUNTIME ERROR: ' + String(error && error.message).slice(0, 700)); if (error && error.managed_stack) { console.log(String(error.managed_stack).slice(0, 900)); } process.exit(99); }