@remix_labs/machine-starter 2.2932.0-dev → 2.2937.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
@@ -56,6 +56,8 @@ globalThis.MixSetMask = (m => {
56
56
  }
57
57
  });
58
58
 
59
+ const DEBUG_STATE = 4;
60
+
59
61
  function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaMQTT) {
60
62
  return StartWASM2(hub, {
61
63
  baseURL: baseURL,
@@ -294,10 +296,12 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
294
296
  return;
295
297
  }
296
298
  let name = msg.payload.name;
297
- let call_id = msg.payload.call_id;
299
+ let call_id = msg.payload.callID;
298
300
  let args = decode(msg.payload.args);
299
301
  let fun = localFFIs[name];
300
- console.log("[groovebox-starter] local FFI call", vmID, call_id, name);
302
+ if (initialMask & DEBUG_STATE) {
303
+ console.debug("[groovebox-starter] local FFI call", vmID, call_id, name);
304
+ };
301
305
  try {
302
306
  if (!fun) throw new Error("No such local FFI in groovebox starter: " + name);
303
307
  let connector =
@@ -310,13 +314,26 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
310
314
  let r = fun instanceof Function ? fun(connector, args) : fun.run(connector, args);
311
315
  if (r instanceof Promise) {
312
316
  // r.catch(_ => null); // prevent "unhandled rejection"
317
+ if (initialMask & DEBUG_STATE) {
318
+ console.debug("[groovebox-starter] running FFI call asynchronously", vmID, call_id, name);
319
+ }
313
320
  await comm.later(call_id);
314
321
  let value = await r;
322
+ if (initialMask & DEBUG_STATE) {
323
+ console.debug("[groovebox-starter] async FFI call returned", vmID, call_id, name);
324
+ };
315
325
  await comm.returnOrFail(fun, call_id, value);
316
326
  } else {
327
+ if (initialMask & DEBUG_STATE) {
328
+ console.debug("[groovebox-starter] sync FFI call returned", vmID, call_id, name);
329
+ };
317
330
  await comm.returnOrFail(fun, call_id, r);
318
331
  }
319
332
  } catch (reason) {
333
+ if (initialMask & DEBUG_STATE) {
334
+ console.debug("[groovebox-starter] FFI call exception", vmID, call_id, name);
335
+ console.debug("[groovebox-starter] exception", reason);
336
+ };
320
337
  await comm.error(call_id, reason.message, reason.stack);
321
338
  }
322
339
  }
@@ -330,14 +347,14 @@ class FFIComm {
330
347
  }
331
348
  later(call_id) {
332
349
  let r_payload =
333
- { call_id: call_id,
350
+ { callID: call_id,
334
351
  };
335
352
  let response = this.hub.newLocalMessage("msg_ffi_later", "starter", r_payload);
336
353
  return this.channel.publish("/local/" + this.vmID + "/ffi/return", response, false);
337
354
  }
338
355
  return_(fun, call_id, result) {
339
356
  let r_payload =
340
- { call_id: call_id,
357
+ { callID: call_id,
341
358
  value: fun.useJsonDecoder ? result : encode(result)
342
359
  };
343
360
  let response = this.hub.newLocalMessage("msg_ffi_return", "starter", r_payload);
@@ -345,7 +362,7 @@ class FFIComm {
345
362
  }
346
363
  error(call_id, message, stack) {
347
364
  let r_payload =
348
- { call_id: call_id,
365
+ { callID: call_id,
349
366
  message: message,
350
367
  stack: stack === undefined ? [] : stack,
351
368
  };
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "3229";
1
+ var GROOVEBOX_BUILD = "3236";
2
2
  export { GROOVEBOX_BUILD }
package/node.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import Process from "process";
2
+ import Console from "console"
2
3
  globalThis.Process = Process;
4
+ globalThis.console = new Console.Console({stdout: process.stderr, stderr: process.stderr });
5
+ // redirect stdout to stderr to avoid that log messages appear in the wrong
6
+ // order
3
7
 
4
8
  // NB: The only way I've made this work in node+webpack is if:
5
9
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/machine-starter",
3
- "version": "2.2932.0-dev",
3
+ "version": "2.2937.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.2932.0-dev",
14
+ "@remix_labs/hub-client": "2.2937.0-dev",
15
15
  "nanoid": "^5.0.2",
16
16
  "web-worker": "^1.2.0"
17
17
  },
package/webpack.config.js CHANGED
@@ -18,6 +18,10 @@ export default [
18
18
  experiments: {
19
19
  outputModule: true
20
20
  },
21
+ externalsType: 'node-commonjs',
22
+ externals: {
23
+ "console": "node:console"
24
+ },
21
25
  output: {
22
26
  chunkFormat: 'module',
23
27
  filename: 'machine-starter.mjs',