@remix_labs/machine-starter 2.2216.0-dev → 2.2218.0-dev
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/common.js +24 -29
- package/groovebox_build.js +1 -1
- package/machine-wasm.worker.js +1 -1
- package/package.json +2 -2
package/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GROOVEBOX_BUILD } from "./groovebox_build.js";
|
|
2
|
-
import {
|
|
2
|
+
import { mixcoreFFINames } from "./mixcore-common.js";
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
|
|
5
5
|
let workers = {};
|
|
@@ -57,8 +57,7 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
|
|
|
57
57
|
})
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
function
|
|
61
|
-
console.log("Mixcore FFIs (local)", names);
|
|
60
|
+
function mixcoreLocalFFIs(mixcore, names) {
|
|
62
61
|
return Object.fromEntries(
|
|
63
62
|
names.map(name => [name, {
|
|
64
63
|
isRaw: true,
|
|
@@ -66,8 +65,8 @@ function makeLocalFFIs(mixcore, names) {
|
|
|
66
65
|
}]));
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
// See `mix-rs/mixcore/
|
|
70
|
-
//
|
|
68
|
+
// See `mix-rs/mixcore/README.md` for a description of the values of
|
|
69
|
+
// config.mixcore.
|
|
71
70
|
async function StartWASM2(hub, config) {
|
|
72
71
|
console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
|
|
73
72
|
let channel = await hub.newChannel();
|
|
@@ -77,30 +76,28 @@ async function StartWASM2(hub, config) {
|
|
|
77
76
|
let localFFIs = config.localFFIs || {};
|
|
78
77
|
if (config.mixcore && config.mixcore.kind == 'mixcore') {
|
|
79
78
|
let {mixcore, enableFFIs, disableFFIs} = config.mixcore;
|
|
80
|
-
let ffiNames = await
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
let ffiNames = await mixcoreFFINames(mixcore, enableFFIs, disableFFIs);
|
|
80
|
+
console.log("Mixcore FFIs (local)", ffiNames);
|
|
81
|
+
let mixcoreFFIs = mixcoreLocalFFIs(mixcore, ffiNames);
|
|
82
|
+
localFFIs = {...localFFIs, ...mixcoreFFIs};
|
|
83
83
|
config.mixcore = null;
|
|
84
84
|
}
|
|
85
85
|
let localFFIkind = {};
|
|
86
86
|
let localFFIfuns = {};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
localFFIkind["$vm_stop"] = vm_kind;
|
|
102
|
-
localFFIfuns["$vm_stop"] = ffi_vm_stop;
|
|
103
|
-
}
|
|
87
|
+
for (const [k, v] of Object.entries(localFFIs)) {
|
|
88
|
+
localFFIfuns[k] = {...v};
|
|
89
|
+
if (v.isRaw && (v.canFail || v.useJsonDecoder)) {
|
|
90
|
+
console.error("A raw, local FFI must neither be failing nor use the JSON decoder: " + k);
|
|
91
|
+
} else {
|
|
92
|
+
localFFIkind[k] = {...v};
|
|
93
|
+
delete localFFIkind[k].run;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
let vm_kind = { isRaw:false, canFail:false, useJsonDecoder:false};
|
|
97
|
+
localFFIkind["$vm_start"] = vm_kind;
|
|
98
|
+
localFFIfuns["$vm_start"] = ffi_vm_start;
|
|
99
|
+
localFFIkind["$vm_stop"] = vm_kind;
|
|
100
|
+
localFFIfuns["$vm_stop"] = ffi_vm_stop;
|
|
104
101
|
let config_msg =
|
|
105
102
|
{ "_rmx_type": "msg_vm_configure",
|
|
106
103
|
"baseURL": config.baseURL,
|
|
@@ -120,8 +117,7 @@ async function StartWASM2(hub, config) {
|
|
|
120
117
|
"mixcore": config.mixcore,
|
|
121
118
|
};
|
|
122
119
|
worker.postMessage(config_msg, [ channel.port ]);
|
|
123
|
-
|
|
124
|
-
setupLocalFFIs(hub, config, localFFIfuns); // don't await!
|
|
120
|
+
setupLocalFFIs(hub, config, localFFIfuns); // don't await!
|
|
125
121
|
return worker;
|
|
126
122
|
}
|
|
127
123
|
|
|
@@ -281,8 +277,7 @@ async function setupLocalFFIs(hub, config, localFFIs) {
|
|
|
281
277
|
let args = decode(msg.payload.args);
|
|
282
278
|
let fun = localFFIs[name];
|
|
283
279
|
try {
|
|
284
|
-
if (!fun)
|
|
285
|
-
throw new Error("no such local FFI: " + name);
|
|
280
|
+
if (!fun) throw new Error("no such local FFI: " + name);
|
|
286
281
|
let connector =
|
|
287
282
|
{ call_id: call_id,
|
|
288
283
|
hub: hub,
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "2395";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|