@remix_labs/machine-starter 2.2786.0-dev → 2.2788.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
@@ -63,10 +63,10 @@ async function StartWASM2(hub, config) {
63
63
  let worker = globalThis.GetMachineWASMWorker();
64
64
  workers[config.vmID] = worker;
65
65
  let localFFIs = config.localFFIs || {};
66
- let mixcoreFFIs = await getMixcoreFFIs(config.mixcore);
67
- if (mixcoreFFIs) {
66
+ let mixcore = getMixcore(config.mixcore);
67
+ if (mixcore) {
68
68
  delete config.mixcore;
69
- Object.assign(localFFIs, mixcoreFFIs);
69
+ await assignMixcoreLocalFFIs(localFFIs, mixcore);
70
70
  }
71
71
  let localFFIkind = {};
72
72
  let localFFIfuns = {};
@@ -345,55 +345,24 @@ class FFIComm {
345
345
  }
346
346
  }
347
347
 
348
- async function getMixcoreFFIs(config) {
348
+ function getMixcore(config) {
349
349
  let mixcore;
350
350
  switch (config?.kind) {
351
351
  case 'mixcore':
352
- mixcore = config.mixcore;
353
- break;
354
- case 'tauri':
355
- mixcore = await MixcoreTauri.create(config.workspace, config.app);
352
+ return config.mixcore;
356
353
  break;
357
354
  default:
358
355
  return;
359
356
  }
357
+ }
358
+
359
+ async function assignMixcoreLocalFFIs(localFFIs, mixcore) {
360
360
  let names = await mixcore.ffiNames();
361
- return Object.fromEntries(
362
- names.map(name => [name, {
361
+ for (let name of names) {
362
+ localFFIs[name] = {
363
363
  isRaw: true,
364
364
  run: (conn, argsBuf) => mixcore.ffiDispatch(conn.call_id, name, argsBuf),
365
- }]));
366
- }
367
-
368
- // tauri commands cannot be dispatched in the worker, so we have to do it here
369
- class MixcoreTauri {
370
-
371
- constructor(id) {
372
- this.id = id;
373
- }
374
-
375
- static async create(workspace, app) {
376
- let id = await window.__TAURI__.core.invoke(
377
- "mixcore_setup",
378
- { workspace, app },
379
- );
380
- return new MixcoreTauri(id);
381
- }
382
-
383
- async ffiNames() {
384
- return await window.__TAURI__.core.invoke(
385
- "mixcore_ffi_names",
386
- {id: this.id},
387
- );
388
- }
389
-
390
- async ffiDispatch(co, name, argsBuf32) {
391
- let argsBuf = Array.from(new Uint8Array(argsBuf32.buffer));
392
- let resBuf = await window.__TAURI__.core.invoke(
393
- "mixcore_ffi_dispatch",
394
- { id: this.id, co, name, argsBuf },
395
- );
396
- return new Uint8Array(resBuf);
365
+ };
397
366
  }
398
367
  }
399
368
 
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "3039";
1
+ var GROOVEBOX_BUILD = "3041";
2
2
  export { GROOVEBOX_BUILD }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/machine-starter",
3
- "version": "2.2786.0-dev",
3
+ "version": "2.2788.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.2786.0-dev",
14
+ "@remix_labs/hub-client": "2.2788.0-dev",
15
15
  "nanoid": "^5.0.2",
16
16
  "web-worker": "^1.2.0"
17
17
  },