@remix_labs/machine-starter 1.1890.0-dev → 1.1898.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/groovebox_build.js +1 -1
- package/index.js +11 -9
- package/node.js +5 -38
- package/package.json +2 -2
- package/{start.mjs → start.js} +2 -2
- package/webpack.config.js +0 -39
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "1898";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|
package/index.js
CHANGED
|
@@ -36,19 +36,20 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
|
|
|
36
36
|
function StartWASM2(hub, config) {
|
|
37
37
|
console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
|
|
38
38
|
return hub.newChannel().then(channel => {
|
|
39
|
-
let
|
|
39
|
+
let bundle;
|
|
40
40
|
if (globalThis.ThisIsNode) {
|
|
41
|
-
|
|
42
|
-
} else {
|
|
41
|
+
bundle = new URL("../../machine-wasm/dist/node-bundle.js", import.meta.url);
|
|
42
|
+
} else if (globalThis.GROOVEBOX_URL_PREFIX) {
|
|
43
43
|
// FIXME: Stopgap solution until we figure out a way to bundle groovebox correctly
|
|
44
|
-
let baseURL = globalThis.GROOVEBOX_URL_PREFIX || "/g";
|
|
45
|
-
|
|
46
44
|
// already fire off the download of the wasm code:
|
|
47
|
-
let code_url = new URL(`${
|
|
45
|
+
let code_url = new URL(`${globalThis.GROOVEBOX_URL_PREFIX}/machine-wasm-code.wasm`, window.location.href);
|
|
48
46
|
fetch(code_url, {cache:"default"}).then(resp => { return resp.arrayBuffer() });
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
bundle = new URL(`${globalThis.GROOVEBOX_URL_PREFIX}/machine-wasm-core.js`, window.location.href);
|
|
48
|
+
} else {
|
|
49
|
+
// already fire off the download of the wasm code:
|
|
50
|
+
let code_url = new URL("/g/machine-wasm-code.wasm", window.location.href);
|
|
51
|
+
fetch(code_url, {cache:"default"}).then(resp => { return resp.arrayBuffer() });
|
|
52
|
+
bundle = new URL("/g/machine-wasm-core.js", window.location.href);
|
|
52
53
|
}
|
|
53
54
|
let localFFIs = {};
|
|
54
55
|
if (config.localFFIs) {
|
|
@@ -61,6 +62,7 @@ function StartWASM2(hub, config) {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
65
|
+
let worker = new Worker(bundle);
|
|
64
66
|
let config_msg =
|
|
65
67
|
{ "_rmx_type": "msg_vm_configure",
|
|
66
68
|
"baseURL": config.baseURL,
|
package/node.js
CHANGED
|
@@ -1,40 +1,7 @@
|
|
|
1
|
+
import Worker from "web-worker";
|
|
2
|
+
global.Worker = Worker;
|
|
3
|
+
import WT from "worker_threads";
|
|
4
|
+
global.MessageChannel = WT.MessageChannel;
|
|
1
5
|
import Process from "process";
|
|
2
6
|
global.Process = Process;
|
|
3
|
-
|
|
4
|
-
// NB: The only way I've made this work in node+webpack is if:
|
|
5
|
-
//
|
|
6
|
-
// * we use Worker from worker_threads directly
|
|
7
|
-
// * we build each worker's module with webpack as an ESM .mjs bundle
|
|
8
|
-
// * we put all the bundles in one directory
|
|
9
|
-
// * we load the worker with a URL('./foo.mjs')
|
|
10
|
-
//
|
|
11
|
-
// Other ways to package/load might work, but definitely seems like
|
|
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
|
-
// is necessary but I'm not sure if this is true for either the main
|
|
16
|
-
// script or the workers.
|
|
17
|
-
import { MessageChannel, Worker } from "worker_threads";
|
|
18
|
-
global.Worker = Worker;
|
|
19
|
-
|
|
20
|
-
import * as Hub from "@remix_labs/hub-client";
|
|
21
|
-
|
|
22
|
-
import { fileURLToPath } from 'url';
|
|
23
|
-
global.__filename = fileURLToPath(import.meta.url);
|
|
24
|
-
|
|
25
|
-
import { CreateVMID, StartWASM, StartWASM2,
|
|
26
|
-
Token, Case, Opaque
|
|
27
|
-
} from "./index.js";
|
|
28
|
-
|
|
29
|
-
export { CreateVMID, StartWASM, StartWASM2,
|
|
30
|
-
Token, Case, Opaque, Hub
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
global.CreateVMID = CreateVMID;
|
|
34
|
-
global.StartWASM2 = StartWASM2;
|
|
35
|
-
global.StartWASM = StartWASM;
|
|
36
|
-
global.Token = Token;
|
|
37
|
-
global.Case = Case;
|
|
38
|
-
global.Opaque = Opaque;
|
|
39
|
-
global.Hub = Hub;
|
|
40
|
-
|
|
7
|
+
export * from "./index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix_labs/machine-starter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1898.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.
|
|
14
|
+
"@remix_labs/hub-client": "1.1898.0-dev",
|
|
15
15
|
"nanoid": "^3.1.12",
|
|
16
16
|
"web-worker": "^1.2.0"
|
|
17
17
|
},
|
package/{start.mjs → start.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Process from "process";
|
|
2
|
-
import { StartWASM2
|
|
3
|
-
|
|
2
|
+
import { StartWASM2 } from "./node.js";
|
|
3
|
+
import * as Hub from "@remix_labs/hub-client";
|
|
4
4
|
if (Process.stdout._handle)
|
|
5
5
|
Process.stdout._handle.setBlocking(true);
|
|
6
6
|
if (Process.stderr._handle)
|
package/webpack.config.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
|
-
import {fileURLToPath} from 'url'
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
|
-
|
|
7
|
-
export default [
|
|
8
|
-
{
|
|
9
|
-
target: 'node',
|
|
10
|
-
mode: "production",
|
|
11
|
-
entry: {
|
|
12
|
-
node: './start.mjs',
|
|
13
|
-
//'hub-worker': './hub-worker.js',
|
|
14
|
-
//'machine-wasm': './machine-wasm.js',
|
|
15
|
-
},
|
|
16
|
-
optimization: {
|
|
17
|
-
minimize: false,
|
|
18
|
-
},
|
|
19
|
-
module: {
|
|
20
|
-
rules: [
|
|
21
|
-
{
|
|
22
|
-
test: /\.js$/,
|
|
23
|
-
loader: '@open-wc/webpack-import-meta-loader'
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
experiments: {
|
|
28
|
-
outputModule: true
|
|
29
|
-
},
|
|
30
|
-
output: {
|
|
31
|
-
chunkFormat: 'module',
|
|
32
|
-
filename: 'machine-starter.mjs',
|
|
33
|
-
library : {
|
|
34
|
-
type: 'module',
|
|
35
|
-
},
|
|
36
|
-
path: path.resolve(__dirname, '../dist'),
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]
|