@remix_labs/machine-starter 2.2053.0-dev → 2.2057.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 { mixcoreFromConfigStarter } from "./mixcore.js";
3
2
  import { nanoid } from "nanoid";
4
3
 
5
4
  let workers = {};
@@ -57,62 +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
- let mixcore = await mixcoreFromConfigStarter(mixcoreConfig);
74
- if (mixcore !== null) {
75
- localFFIs = {...localFFIs, ...mixcore.localFFIs()};
76
- mixcoreConfig = null;
77
- }
78
- if (localFFIs) {
79
- for (const [k, v] of Object.entries(localFFIs)) {
80
- localFFIfuns[k] = {...v};
81
- if (v.isRaw && (v.canFail || v.useJsonDecoder)) {
82
- console.error("A raw, local FFI must neither be failing nor use the JSON decoder: " + k);
83
- } else {
84
- localFFIkind[k] = {...v};
85
- delete localFFIkind[k].run;
86
- }
87
- };
88
- let vm_kind = { isRaw:false, canFail:false, useJsonDecoder:false};
89
- localFFIkind["$vm_start"] = vm_kind;
90
- localFFIfuns["$vm_start"] = ffi_vm_start;
91
- localFFIkind["$vm_stop"] = vm_kind;
92
- localFFIfuns["$vm_stop"] = ffi_vm_stop;
93
- }
94
- let config_msg =
95
- { "_rmx_type": "msg_vm_configure",
96
- "baseURL": config.baseURL,
97
- "org": config.org,
98
- "workspace": config.workspace,
99
- "vmID": config.vmID,
100
- "user": config.user,
101
- "token": config.token,
102
- "hub": channel.port,
103
- "outputViaMQTT": !(config.noOutputViaMQTT),
104
- "machType": config.machType,
105
- "debugMask": initialMask,
106
- "localFFIs": localFFIkind,
107
- "allowInsecureHttp": globalThis.GROOVEBOX_ALLOW_INSECURE_HTTP,
108
- "interceptFFI": config.interceptFFI,
109
- "interceptDynloadFFI": config.interceptDynloadFFI,
110
- "mixcore": mixcoreConfig,
111
- };
112
- worker.postMessage(config_msg, [ channel.port ]);
113
- if (localFFIs)
114
- setupLocalFFIs(hub, config, localFFIfuns); // don't await!
115
- 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
+ })
116
105
  }
117
106
 
118
107
  async function ffi_vm_start(conn, args) {
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "2198";
1
+ var GROOVEBOX_BUILD = "2202";
2
2
  export { GROOVEBOX_BUILD }