@remix_labs/machine-starter 2.2782.0 → 2.2788.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 +25 -36
- package/groovebox_build.js +1 -1
- package/package.json +2 -2
package/common.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GROOVEBOX_BUILD } from "./groovebox_build.js";
|
|
2
|
-
import { filterFFINames } from "./mixcore-common.js";
|
|
3
2
|
import { nanoid } from "nanoid";
|
|
4
3
|
|
|
5
4
|
let workers = {};
|
|
@@ -57,35 +56,17 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
|
|
|
57
56
|
})
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
function mixcoreLocalFFIs(mixcore, names) {
|
|
61
|
-
return Object.fromEntries(
|
|
62
|
-
names.map(name => [name, {
|
|
63
|
-
isRaw: true,
|
|
64
|
-
run: (conn, argsBuf) => mixcore.ffiDispatch(conn.call_id, name, argsBuf),
|
|
65
|
-
}]));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// See `mix-rs/mixcore/README.md` for a description of the values of
|
|
69
|
-
// config.mixcore.
|
|
70
59
|
async function StartWASM2(hub, config) {
|
|
71
60
|
console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
|
|
72
61
|
let channel = await hub.newChannel();
|
|
73
62
|
// injected by either index.js or node.js
|
|
74
63
|
let worker = globalThis.GetMachineWASMWorker();
|
|
75
64
|
workers[config.vmID] = worker;
|
|
76
|
-
let mixcore = null;
|
|
77
65
|
let localFFIs = config.localFFIs || {};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
console.log("Mixcore (starter)", mixcore, ffiNames, mixcore.registerDebugObject);
|
|
83
|
-
localFFIs = {...localFFIs, ...mixcoreLocalFFIs(mixcore, ffiNames)};
|
|
84
|
-
config.mixcore = {};
|
|
85
|
-
if (mixcore.registerDebugObject) {
|
|
86
|
-
config.mixcore.publishDebugObjects = true;
|
|
87
|
-
subscribeDebugObjects(mixcore, hub, config);
|
|
88
|
-
}
|
|
66
|
+
let mixcore = getMixcore(config.mixcore);
|
|
67
|
+
if (mixcore) {
|
|
68
|
+
delete config.mixcore;
|
|
69
|
+
await assignMixcoreLocalFFIs(localFFIs, mixcore);
|
|
89
70
|
}
|
|
90
71
|
let localFFIkind = {};
|
|
91
72
|
let localFFIfuns = {};
|
|
@@ -308,19 +289,6 @@ async function setupLocalFFIs(hub, config, localFFIs) {
|
|
|
308
289
|
}
|
|
309
290
|
}
|
|
310
291
|
|
|
311
|
-
async function subscribeDebugObjects(mixcore, hub, config) {
|
|
312
|
-
let channel = await hub.newChannel();
|
|
313
|
-
let vmID = config.vmID;
|
|
314
|
-
await channel.setLocalSubTopic(`/debug-objects/${vmID}`);
|
|
315
|
-
let sub = await channel.subscribe(`/debug-objects/${vmID}`);
|
|
316
|
-
while (true) {
|
|
317
|
-
let msg = await sub.next();
|
|
318
|
-
let id = msg.payload.id;
|
|
319
|
-
let code = msg.payload.code;
|
|
320
|
-
mixcore.registerDebugObject(id, code);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
292
|
class FFIComm {
|
|
325
293
|
constructor(vmID, hub, channel) {
|
|
326
294
|
this.vmID = vmID;
|
|
@@ -377,6 +345,27 @@ class FFIComm {
|
|
|
377
345
|
}
|
|
378
346
|
}
|
|
379
347
|
|
|
348
|
+
function getMixcore(config) {
|
|
349
|
+
let mixcore;
|
|
350
|
+
switch (config?.kind) {
|
|
351
|
+
case 'mixcore':
|
|
352
|
+
return config.mixcore;
|
|
353
|
+
break;
|
|
354
|
+
default:
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
async function assignMixcoreLocalFFIs(localFFIs, mixcore) {
|
|
360
|
+
let names = await mixcore.ffiNames();
|
|
361
|
+
for (let name of names) {
|
|
362
|
+
localFFIs[name] = {
|
|
363
|
+
isRaw: true,
|
|
364
|
+
run: (conn, argsBuf) => mixcore.ffiDispatch(conn.call_id, name, argsBuf),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
380
369
|
// use worker.terminate() to shut a worker down!
|
|
381
370
|
|
|
382
371
|
export { StartWASM, StartWASM2, terminateAll, terminateVM,
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "3041";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix_labs/machine-starter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2788.0-dev",
|
|
4
4
|
"description": "start the groove",
|
|
5
5
|
"main": "node.js",
|
|
6
6
|
"browser": "index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Remixlabs staff",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@remix_labs/hub-client": "2.
|
|
14
|
+
"@remix_labs/hub-client": "2.2788.0-dev",
|
|
15
15
|
"nanoid": "^5.0.2",
|
|
16
16
|
"web-worker": "^1.2.0"
|
|
17
17
|
},
|