@remix_labs/machine-starter 2.2170.0-dev → 2.2175.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 CHANGED
@@ -1,5 +1,4 @@
1
1
  import { GROOVEBOX_BUILD } from "./groovebox_build.js";
2
- import { mixcoreFromConfig } from "./mixcore.js";
3
2
  import { nanoid } from "nanoid";
4
3
 
5
4
  let workers = {};
@@ -57,64 +56,52 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
57
56
  })
58
57
  }
59
58
 
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) {
59
+ function StartWASM2(hub, config) {
63
60
  console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
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;
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
+ })
118
105
  }
119
106
 
120
107
  async function ffi_vm_start(conn, args) {
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "2339";
1
+ var GROOVEBOX_BUILD = "2344";
2
2
  export { GROOVEBOX_BUILD }