porffor 0.17.0-589ace465 → 0.17.0-7a608f8cb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/runner/debug.js +1 -1
- package/runner/index.js +2 -2
- package/runner/profile.js +1 -1
- package/runner/repl.js +5 -5
package/package.json
CHANGED
package/runner/debug.js
CHANGED
@@ -43,7 +43,7 @@ let lastLine;
|
|
43
43
|
let output = '';
|
44
44
|
|
45
45
|
try {
|
46
|
-
const { exports } =
|
46
|
+
const { exports } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {
|
47
47
|
y: n => {
|
48
48
|
if (callStarts[callStarts.length - 1] === n - 1) {
|
49
49
|
// end of call
|
package/runner/index.js
CHANGED
@@ -137,7 +137,7 @@ try {
|
|
137
137
|
|
138
138
|
console.log(`\n\nwasm size: ${wasm.byteLength} bytes`);
|
139
139
|
} else {
|
140
|
-
const { exports } =
|
140
|
+
const { exports } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {}, print);
|
141
141
|
|
142
142
|
runStart = performance.now();
|
143
143
|
if (!process.argv.includes('--no-run')) exports.main();
|
@@ -146,7 +146,7 @@ try {
|
|
146
146
|
} catch (e) {
|
147
147
|
// if (cache) process.stdout.write(cache);
|
148
148
|
let out = e;
|
149
|
-
if (!process.argv.includes('-i') && e.
|
149
|
+
if (!process.argv.includes('-i') && Object.getPrototypeOf(e).message != null) out = `${e.constructor.name}${e.message != null ? `: ${e.message}` : ''}`;
|
150
150
|
console.error(out);
|
151
151
|
}
|
152
152
|
|
package/runner/profile.js
CHANGED
@@ -20,7 +20,7 @@ let spin = 0;
|
|
20
20
|
let last = 0;
|
21
21
|
|
22
22
|
try {
|
23
|
-
const { exports } =
|
23
|
+
const { exports } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {
|
24
24
|
y: n => {
|
25
25
|
tmp[n] = performance.now();
|
26
26
|
},
|
package/runner/repl.js
CHANGED
@@ -80,13 +80,13 @@ const memoryToString = mem => {
|
|
80
80
|
};
|
81
81
|
|
82
82
|
let prev = '';
|
83
|
-
const run =
|
83
|
+
const run = (source, _context, _filename, callback, run = true) => {
|
84
84
|
// hack: print "secret" before latest code ran to only enable printing for new code
|
85
85
|
|
86
86
|
let toRun = (prev ? (prev + `;\nprint(-0x1337);\n`) : '') + source.trim();
|
87
87
|
|
88
88
|
let shouldPrint = !prev;
|
89
|
-
const { exports, pages } =
|
89
|
+
const { exports, pages } = compile(toRun, [], {}, str => {
|
90
90
|
if (shouldPrint) process.stdout.write(str);
|
91
91
|
if (str === '-4919') shouldPrint = true;
|
92
92
|
});
|
@@ -127,12 +127,12 @@ replServer.defineCommand('memory', {
|
|
127
127
|
});
|
128
128
|
replServer.defineCommand('asm', {
|
129
129
|
help: 'Log Wasm decompiled bytecode',
|
130
|
-
|
130
|
+
action() {
|
131
131
|
this.clearBufferedCommand();
|
132
132
|
|
133
133
|
try {
|
134
134
|
process.argv.push('--opt-funcs');
|
135
|
-
|
135
|
+
run('', null, null, () => {}, false);
|
136
136
|
process.argv.pop();
|
137
137
|
} catch { }
|
138
138
|
|
@@ -141,7 +141,7 @@ replServer.defineCommand('asm', {
|
|
141
141
|
});
|
142
142
|
replServer.defineCommand('js', {
|
143
143
|
help: 'Log JS being actually ran',
|
144
|
-
|
144
|
+
action() {
|
145
145
|
this.clearBufferedCommand();
|
146
146
|
console.log(prev);
|
147
147
|
this.displayPrompt();
|