porffor 0.17.0-7a608f8cb → 0.17.0-8677c8b6b
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/compiler/wrap.js +1 -1
- package/package.json +1 -1
- package/runner/debug.js +1 -1
- package/runner/index.js +3 -3
- package/runner/profile.js +1 -1
- package/runner/repl.js +5 -5
package/compiler/wrap.js
CHANGED
@@ -140,7 +140,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
|
|
140
140
|
|
141
141
|
globalThis.porfDebugInfo = { funcs, globals };
|
142
142
|
|
143
|
-
|
143
|
+
if (process.argv[1].includes('/runner') && source.includes?.('export ')) flags.push('module');
|
144
144
|
|
145
145
|
// fs.writeFileSync('out.wasm', Buffer.from(wasm));
|
146
146
|
|
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 } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {
|
46
|
+
const { exports } = await 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
@@ -130,14 +130,14 @@ const print = str => {
|
|
130
130
|
let runStart;
|
131
131
|
try {
|
132
132
|
if (process.argv.includes('-b')) {
|
133
|
-
const { wasm, exports } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {}, print);
|
133
|
+
const { wasm, exports } = await compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {}, print);
|
134
134
|
|
135
135
|
runStart = performance.now();
|
136
136
|
if (!process.argv.includes('--no-run')) exports.main();
|
137
137
|
|
138
138
|
console.log(`\n\nwasm size: ${wasm.byteLength} bytes`);
|
139
139
|
} else {
|
140
|
-
const { exports } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {}, print);
|
140
|
+
const { exports } = await 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') &&
|
149
|
+
if (!process.argv.includes('-i') && e.__proto__.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 } = compile(source, process.argv.includes('--module') ? [ 'module' ] : [], {
|
23
|
+
const { exports } = await 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 = (source, _context, _filename, callback, run = true) => {
|
83
|
+
const run = async (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 } = compile(toRun, [], {}, str => {
|
89
|
+
const { exports, pages } = await 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
|
-
action() {
|
130
|
+
async action() {
|
131
131
|
this.clearBufferedCommand();
|
132
132
|
|
133
133
|
try {
|
134
134
|
process.argv.push('--opt-funcs');
|
135
|
-
run('', null, null, () => {}, false);
|
135
|
+
await 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
|
-
action() {
|
144
|
+
async action() {
|
145
145
|
this.clearBufferedCommand();
|
146
146
|
console.log(prev);
|
147
147
|
this.displayPrompt();
|