From 37e46d89eeded45e04fafc8222c1aac1f2cab42b Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Sat, 15 Jun 2019 15:37:14 +0300 Subject: [PATCH] add env:abort stub for template in asinit script --- bin/asinit | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/asinit b/bin/asinit index 5c312cc5fb..f251eef297 100644 --- a/bin/asinit +++ b/bin/asinit @@ -26,7 +26,6 @@ const rl = require("readline").createInterface({ const projectDir = path.resolve(process.argv[2]); const compilerDir = path.join(__dirname, ".."); -const compilerVersion = require(path.join(compilerDir, "package.json")).version; const assemblyDir = path.join(projectDir, "assembly"); const tsconfigFile = path.join(assemblyDir, "tsconfig.json"); const tsconfigBase = path.relative(assemblyDir, path.join(compilerDir, "std", "assembly.json")); @@ -245,7 +244,13 @@ function ensureIndexJs() { fs.writeFileSync(indexFile, [ "const fs = require(\"fs\");", "const compiled = new WebAssembly.Module(fs.readFileSync(__dirname + \"/build/optimized.wasm\"));", - "const imports = {};", + "const imports = {", + " env: {", + " abort(_msg, _file, line, column) {", + " console.error(\"abort called at index.ts:\" + line + \":\" + column);", + " }", + " }", + "};", "Object.defineProperty(module, \"exports\", {", " get: () => new WebAssembly.Instance(compiled, imports).exports", "});",