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