@remix_labs/machine-starter 1.1888.0-dev → 1.1890.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.
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "1888";
1
+ var GROOVEBOX_BUILD = "1890";
2
2
  export { GROOVEBOX_BUILD }
package/index.js CHANGED
@@ -38,21 +38,16 @@ function StartWASM2(hub, config) {
38
38
  return hub.newChannel().then(channel => {
39
39
  let worker;
40
40
  if (globalThis.ThisIsNode) {
41
- worker = globalThis.getMachineWasmWorker();
41
+ worker = new Worker(new URL("./machine-wasm.mjs", import.meta.url));
42
42
  } else {
43
- let bundle;
44
- if (globalThis.GROOVEBOX_URL_PREFIX) {
45
- // FIXME: Stopgap solution until we figure out a way to bundle groovebox correctly
46
- // already fire off the download of the wasm code:
47
- let code_url = new URL(`${globalThis.GROOVEBOX_URL_PREFIX}/machine-wasm-code.wasm`, window.location.href);
48
- fetch(code_url, {cache:"default"}).then(resp => { return resp.arrayBuffer() });
49
- bundle = new URL(`${globalThis.GROOVEBOX_URL_PREFIX}/machine-wasm-core.js`, window.location.href);
50
- } else {
51
- // already fire off the download of the wasm code:
52
- let code_url = new URL("/g/machine-wasm-code.wasm", window.location.href);
53
- fetch(code_url, {cache:"default"}).then(resp => { return resp.arrayBuffer() });
54
- bundle = new URL("/g/machine-wasm-core.js", window.location.href);
55
- }
43
+ // FIXME: Stopgap solution until we figure out a way to bundle groovebox correctly
44
+ let baseURL = globalThis.GROOVEBOX_URL_PREFIX || "/g";
45
+
46
+ // already fire off the download of the wasm code:
47
+ let code_url = new URL(`${baseURL}/machine-wasm-code.wasm`, window.location.href);
48
+ fetch(code_url, {cache:"default"}).then(resp => { return resp.arrayBuffer() });
49
+
50
+ let bundle = new URL(`${baseURL}/machine-wasm-core.js`, window.location.href);
56
51
  worker = new Worker(bundle);
57
52
  }
58
53
  let localFFIs = {};
package/node.js CHANGED
@@ -1,5 +1,3 @@
1
- import { MessageChannel, Worker } from "worker_threads";
2
- global.MessageChannel = MessageChannel;
3
1
  import Process from "process";
4
2
  global.Process = Process;
5
3
 
@@ -8,21 +6,16 @@ global.Process = Process;
8
6
  // * we use Worker from worker_threads directly
9
7
  // * we build each worker's module with webpack as an ESM .mjs bundle
10
8
  // * we put all the bundles in one directory
11
- // * we load the worker as below with a URL('./foo.mjs')
9
+ // * we load the worker with a URL('./foo.mjs')
12
10
  //
13
11
  // Other ways to package/load might work, but definitely seems like
14
- // using worker_threads.Worker directly is needed. Webpack says ESM
12
+ // using worker_threads.Worker directly is needed (rather than through,
13
+ // say, the web-worker packages that wraps either worker_threads.Worker
14
+ // or the browser Worker to give the same interface). Webpack says ESM
15
15
  // is necessary but I'm not sure if this is true for either the main
16
16
  // script or the workers.
17
- global.getHubWorker = () => {
18
- console.log(`getting hub-worker worker`);
19
- return new Worker(new URL("./hub-worker.mjs", import.meta.url))
20
- }
21
-
22
- global.getMachineWasmWorker = () => {
23
- console.log("getting machine-wasm worker");
24
- return new Worker(new URL("./machine-wasm.mjs", import.meta.url))
25
- }
17
+ import { MessageChannel, Worker } from "worker_threads";
18
+ global.Worker = Worker;
26
19
 
27
20
  import * as Hub from "@remix_labs/hub-client";
28
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/machine-starter",
3
- "version": "1.1888.0-dev",
3
+ "version": "1.1890.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": "1.1888.0-dev",
14
+ "@remix_labs/hub-client": "1.1890.0-dev",
15
15
  "nanoid": "^3.1.12",
16
16
  "web-worker": "^1.2.0"
17
17
  },