@remix_labs/machine-starter 2.3336.0-dev → 2.3340.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 +31 -2
- package/groovebox_build.js +1 -1
- package/package.json +2 -2
- package/start.js +3 -8
package/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GROOVEBOX_BUILD } from "./groovebox_build.js";
|
|
2
2
|
import { nanoid } from "nanoid";
|
|
3
|
-
import {
|
|
3
|
+
import { MixcoreTauri, filterFFINames } from "./mixcore.lib.mjs";
|
|
4
4
|
|
|
5
5
|
const DEBUG_STATE = 4;
|
|
6
6
|
|
|
@@ -126,8 +126,9 @@ async function StartWASM2(hub, config) {
|
|
|
126
126
|
let starterFFIs = config.localFFIs || {};
|
|
127
127
|
// from now on, the "local" FFIs are called "starter" FFIs, because this
|
|
128
128
|
// distinguishes these from other locally defined FFIs
|
|
129
|
-
let mixcoreFFIs = await
|
|
129
|
+
let mixcoreFFIs = await getMixcoreFFIs(config.mixcore);
|
|
130
130
|
if (mixcoreFFIs) {
|
|
131
|
+
console.log("[machine-starter] mixcore FFIs", Object.keys(mixcoreFFIs));
|
|
131
132
|
// merge the ffis and store them back into the config so sub vms also get them
|
|
132
133
|
config.localFFIs = Object.assign(starterFFIs, mixcoreFFIs);
|
|
133
134
|
// delete the mixcore config to avoid being handled further by the worker
|
|
@@ -484,6 +485,34 @@ class FFIComm {
|
|
|
484
485
|
}
|
|
485
486
|
}
|
|
486
487
|
|
|
488
|
+
async function getMixcoreFFIs(config) {
|
|
489
|
+
let mixcore;
|
|
490
|
+
switch (config?.kind) {
|
|
491
|
+
case 'mixcore':
|
|
492
|
+
mixcore = config.mixcore;
|
|
493
|
+
break;
|
|
494
|
+
case 'tauri':
|
|
495
|
+
mixcore = await MixcoreTauri.create(config.workspace, config.app);
|
|
496
|
+
break;
|
|
497
|
+
default:
|
|
498
|
+
console.warn("[machine-starter] not going to configure mixcore - kind: ", config?.kind);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
let names = await mixcore.ffiNames();
|
|
503
|
+
names = filterFFINames(names, config.enableFFIs, config.disableFFIs);
|
|
504
|
+
|
|
505
|
+
let starterFFIs = {};
|
|
506
|
+
for (let name of names) {
|
|
507
|
+
starterFFIs[name] = {
|
|
508
|
+
isRaw: true,
|
|
509
|
+
run: (conn, argsBuf) => mixcore.ffiDispatch(conn.call_id, name, argsBuf),
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return starterFFIs;
|
|
514
|
+
}
|
|
515
|
+
|
|
487
516
|
// use terminateVM to shut a worker down!
|
|
488
517
|
export { StartWASM, StartWASM2, terminateAll, terminateVM,
|
|
489
518
|
Token, Case, Opaque
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "3340";
|
|
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.3340.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.3340.0-dev",
|
|
15
15
|
"nanoid": "^5.0.2",
|
|
16
16
|
"web-worker": "^1.2.0"
|
|
17
17
|
},
|
package/start.js
CHANGED
|
@@ -32,17 +32,12 @@ let noOutputViaMQTT = Process.env["MIX_MQTT_NO_OUTPUT"] !== undefined;
|
|
|
32
32
|
console.log("Machine params: variant=" + variant + " baseURL=" + baseURL, " mqttURL=" + mqttURL, " mqttUser=" + mqttUser, " mqttToken=" + mqttToken, " id=" + id, " noOutputViaMQTT=" + noOutputViaMQTT);
|
|
33
33
|
let w = new Hub.Worker();
|
|
34
34
|
globalThis.GROOVEBOX_ALLOW_INSECURE_HTTP = true;
|
|
35
|
-
|
|
36
|
-
// Node does not support blob (for dynamic import?), results in error:
|
|
37
|
-
// [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and
|
|
38
|
-
// node are supported by the default ESM loader. Received protocol 'blob:'
|
|
39
|
-
let mixcoreJsUrl = "data:text/javascript;base64," + mixcoreJsBase64;
|
|
40
35
|
let mixcoreWasmUrl = "data:application/wasm;base64," + mixcoreWasmBase64;
|
|
41
|
-
|
|
36
|
+
let mixcoreJsUrl = "data:text/javascript;charset=utf-8;base64," + mixcoreJsBase64;
|
|
42
37
|
let mixcore = {
|
|
43
|
-
kind: "wasm",
|
|
44
|
-
mixcoreJsUrl,
|
|
38
|
+
kind: "wasm-opfs",
|
|
45
39
|
mixcoreWasmUrl,
|
|
40
|
+
mixcoreJsUrl,
|
|
46
41
|
dbDir: "/databases",
|
|
47
42
|
dbUser: "test@user",
|
|
48
43
|
dbName: "compiler-testing",
|