@remix_labs/machine-starter 2.2126.0 → 2.2130.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 +58 -45
- package/groovebox_build.js +1 -1
- package/machine-wasm.worker.js +1 -1
- package/package.json +2 -2
- package/start.js +7 -0
package/common.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GROOVEBOX_BUILD } from "./groovebox_build.js";
|
|
2
|
+
import { mixcoreFromConfig } from "./mixcore.js";
|
|
2
3
|
import { nanoid } from "nanoid";
|
|
3
4
|
|
|
4
5
|
let workers = {};
|
|
@@ -56,52 +57,64 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
|
|
|
56
57
|
})
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
// See `mix-rs/mixcore/bindings/javascript/mixcore.js` for a description of the
|
|
61
|
+
// values of config.mixcore.
|
|
62
|
+
async function StartWASM2(hub, config) {
|
|
60
63
|
console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
localFFIfuns[
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
64
|
+
let channel = await hub.newChannel();
|
|
65
|
+
// injected by either index.js or node.js
|
|
66
|
+
let worker = globalThis.GetMachineWASMWorker();
|
|
67
|
+
workers[config.vmID] = worker;
|
|
68
|
+
let mixcoreConfig = config.mixcore;
|
|
69
|
+
let localFFIs = config.localFFIs;
|
|
70
|
+
let localFFIkind = {};
|
|
71
|
+
let localFFIfuns = {};
|
|
72
|
+
|
|
73
|
+
if (mixcoreConfig && mixcoreConfig.kind == "mixcore") {
|
|
74
|
+
// this is the only mixcore kind that has to be realized in the starter,
|
|
75
|
+
// because it cannot be sent to the worker
|
|
76
|
+
let mixcore = await mixcoreFromConfig(mixcoreConfig);
|
|
77
|
+
localFFIs = {...localFFIs, ...mixcore.localFFIs()};
|
|
78
|
+
mixcoreConfig = null; // this gets passed on to the worker
|
|
79
|
+
}
|
|
80
|
+
if (localFFIs) {
|
|
81
|
+
for (const [k, v] of Object.entries(localFFIs)) {
|
|
82
|
+
localFFIfuns[k] = {...v};
|
|
83
|
+
if (v.isRaw && (v.canFail || v.useJsonDecoder)) {
|
|
84
|
+
console.error("A raw, local FFI must neither be failing nor use the JSON decoder: " + k);
|
|
85
|
+
} else {
|
|
86
|
+
localFFIkind[k] = {...v};
|
|
87
|
+
delete localFFIkind[k].run;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
let vm_kind = { isRaw:false, canFail:false, useJsonDecoder:false};
|
|
91
|
+
localFFIkind["$vm_start"] = vm_kind;
|
|
92
|
+
localFFIfuns["$vm_start"] = ffi_vm_start;
|
|
93
|
+
localFFIkind["$vm_stop"] = vm_kind;
|
|
94
|
+
localFFIfuns["$vm_stop"] = ffi_vm_stop;
|
|
95
|
+
}
|
|
96
|
+
let config_msg =
|
|
97
|
+
{ "_rmx_type": "msg_vm_configure",
|
|
98
|
+
"baseURL": config.baseURL,
|
|
99
|
+
"org": config.org,
|
|
100
|
+
"workspace": config.workspace,
|
|
101
|
+
"vmID": config.vmID,
|
|
102
|
+
"user": config.user,
|
|
103
|
+
"token": config.token,
|
|
104
|
+
"hub": channel.port,
|
|
105
|
+
"outputViaMQTT": !(config.noOutputViaMQTT),
|
|
106
|
+
"machType": config.machType,
|
|
107
|
+
"debugMask": initialMask,
|
|
108
|
+
"localFFIs": localFFIkind,
|
|
109
|
+
"allowInsecureHttp": globalThis.GROOVEBOX_ALLOW_INSECURE_HTTP,
|
|
110
|
+
"interceptFFI": config.interceptFFI,
|
|
111
|
+
"interceptDynloadFFI": config.interceptDynloadFFI,
|
|
112
|
+
"mixcore": mixcoreConfig,
|
|
113
|
+
};
|
|
114
|
+
worker.postMessage(config_msg, [ channel.port ]);
|
|
115
|
+
if (localFFIs)
|
|
116
|
+
setupLocalFFIs(hub, config, localFFIfuns); // don't await!
|
|
117
|
+
return worker;
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
async function ffi_vm_start(conn, args) {
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "2292";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|