@remix_labs/machine-starter 2.3207.0-dev → 2.3211.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
@@ -2,8 +2,6 @@ import { GROOVEBOX_BUILD } from "./groovebox_build.js";
2
2
  import { nanoid } from "nanoid";
3
3
  import { MixcoreTauri, filterFFINames } from "./mixcore.lib.mjs";
4
4
 
5
- const DEBUG_QUEUES = 2048;
6
-
7
5
  let last_hub = null;
8
6
 
9
7
  let workers = {};
@@ -101,6 +99,8 @@ globalThis.MixSetMask = (m => {
101
99
  }
102
100
  });
103
101
 
102
+ const DEBUG_STATE = 4;
103
+
104
104
  function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaMQTT) {
105
105
  return StartWASM2(hub, {
106
106
  baseURL: baseURL,
@@ -359,11 +359,12 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
359
359
  return;
360
360
  }
361
361
  let name = msg.payload.name;
362
- let call_id = msg.payload.call_id;
362
+ let call_id = msg.payload.callID;
363
363
  let args = decode(msg.payload.args);
364
364
  let fun = localFFIs[name];
365
- if (initialMask & DEBUG_QUEUES)
365
+ if (initialMask & DEBUG_STATE) {
366
366
  console.debug("[groovebox-starter] local FFI call", vmID, call_id, name);
367
+ };
367
368
  try {
368
369
  if (!fun) throw new Error("No such local FFI in groovebox starter: " + name);
369
370
  let connector =
@@ -376,20 +377,23 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
376
377
  let r = fun instanceof Function ? fun(connector, args) : fun.run(connector, args);
377
378
  if (r instanceof Promise) {
378
379
  // r.catch(_ => null); // prevent "unhandled rejection"
379
- if (initialMask & DEBUG_QUEUES)
380
+ if (initialMask & DEBUG_STATE) {
380
381
  console.debug("[groovebox-starter] running FFI call asynchronously", vmID, call_id, name);
382
+ }
381
383
  await comm.later(call_id);
382
384
  let value = await r;
383
- if (initialMask & DEBUG_QUEUES)
385
+ if (initialMask & DEBUG_STATE) {
384
386
  console.debug("[groovebox-starter] async FFI call returned", vmID, call_id, name);
387
+ };
385
388
  await comm.returnOrFail(fun, call_id, value);
386
389
  } else {
387
- if (initialMask & DEBUG_QUEUES)
390
+ if (initialMask & DEBUG_STATE) {
388
391
  console.debug("[groovebox-starter] sync FFI call returned", vmID, call_id, name);
392
+ };
389
393
  await comm.returnOrFail(fun, call_id, r);
390
394
  }
391
395
  } catch (reason) {
392
- if (initialMask & DEBUG_QUEUES) {
396
+ if (initialMask & DEBUG_STATE) {
393
397
  console.debug("[groovebox-starter] FFI call exception", vmID, call_id, name);
394
398
  console.debug("[groovebox-starter] exception", reason);
395
399
  };
@@ -435,14 +439,14 @@ class FFIComm {
435
439
  }
436
440
  later(call_id) {
437
441
  let r_payload =
438
- { call_id: call_id,
442
+ { callID: call_id,
439
443
  };
440
444
  let response = this.hub.newLocalMessage("msg_ffi_later", "starter", r_payload);
441
445
  return this.channel.publish("/local/" + this.vmID + "/ffi/return", response, false);
442
446
  }
443
447
  return_(fun, call_id, result) {
444
448
  let r_payload =
445
- { call_id: call_id,
449
+ { callID: call_id,
446
450
  value: fun.useJsonDecoder ? result : encode(result)
447
451
  };
448
452
  let response = this.hub.newLocalMessage("msg_ffi_return", "starter", r_payload);
@@ -450,7 +454,7 @@ class FFIComm {
450
454
  }
451
455
  error(call_id, message, stack) {
452
456
  let r_payload =
453
- { call_id: call_id,
457
+ { callID: call_id,
454
458
  message: message,
455
459
  stack: stack === undefined ? [] : stack,
456
460
  };
@@ -493,7 +497,6 @@ async function getMixcoreFFIs(config) {
493
497
  mixcore = await MixcoreTauri.create(config.workspace, config.app);
494
498
  break;
495
499
  default:
496
- console.warn("[machine-starter] not going to configure mixcore - kind: ", config?.kind);
497
500
  return;
498
501
  }
499
502
 
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "3207";
1
+ var GROOVEBOX_BUILD = "3211";
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.3207.0-dev",
3
+ "version": "2.3211.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.3207.0-dev",
14
+ "@remix_labs/hub-client": "2.3211.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',