@remix_labs/machine-starter 2.2043.0 → 2.2050.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 +81 -45
- package/groovebox_build.js +1 -1
- package/machine-wasm.worker.js +1 -1
- package/package.json +2 -2
- package/start.js +7 -0
package/common.js
CHANGED
|
@@ -56,52 +56,88 @@ function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaM
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// The parameter config.mixcore controls the mixcore integration. it can be one
|
|
60
|
+
// of the following:
|
|
61
|
+
//
|
|
62
|
+
// - {kind: "mixcore", mixcore: Mixcore}: use an already instantiated Mixcore
|
|
63
|
+
// - {kind: "webkit"}: use Webkit backend implemented in
|
|
64
|
+
// `mixcore/bindings/swift/Mixcore.swift` and used in flutter-runtime
|
|
65
|
+
// (AppClipWebview.swift and appclip.html)
|
|
66
|
+
// - {kind: "tauri", dbDir: STRING, dbName: STRING, dbUser: STRING}: use
|
|
67
|
+
// Tauri backend for turntable/remix-desktop, implemented in
|
|
68
|
+
// `mix-rs/mixcore/bindings/tauri/mixcore_tauri.rs`
|
|
69
|
+
// - {kind: "wasm", dbDir: STRING, dbName: STRING, dbUser: STRING, url: STRING}:
|
|
70
|
+
// use the Wasm backend, the `url` can something `fetch`able, or `file://` on
|
|
71
|
+
// node
|
|
72
|
+
// - {kind: "serviceworker", url: STRING, "dbName": STRING, "dbUser": STRING}
|
|
73
|
+
async function StartWASM2(hub, config) {
|
|
60
74
|
console.log("GROOVEBOX_BUILD (machine-starter)", GROOVEBOX_BUILD);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
75
|
+
let channel = await hub.newChannel();
|
|
76
|
+
// injected by either index.js or node.js
|
|
77
|
+
let worker = globalThis.GetMachineWASMWorker();
|
|
78
|
+
workers[config.vmID] = worker;
|
|
79
|
+
let mixcoreConfig = config.mixcore;
|
|
80
|
+
let localFFIs = config.localFFIs;
|
|
81
|
+
let localFFIkind = {};
|
|
82
|
+
let localFFIfuns = {};
|
|
83
|
+
|
|
84
|
+
console.log("MIXCORE CONFIG", mixcoreConfig);
|
|
85
|
+
if (mixcoreConfig && mixcoreConfig.kind == "mixcore") {
|
|
86
|
+
await mixcoreConfig.mixcore.setHandleFFIs(mixcoreConfig.includes, mixcoreConfig.excludes);
|
|
87
|
+
localFFIs = {...localFFIs, ...mixcore.localFFIs()};
|
|
88
|
+
mixcoreConfig = null;
|
|
89
|
+
}
|
|
90
|
+
if (mixcoreConfig && mixcoreConfig.kind == "wasm-instance") {
|
|
91
|
+
// this is the only mixcore configuration that cannot be to the
|
|
92
|
+
// machine-wasm. the FFIs are registered as localFFIs.
|
|
93
|
+
let mixcore = new MixcoreWasm(
|
|
94
|
+
mixcoreConfig.dbDir,
|
|
95
|
+
mixcoreConfig.dbName,
|
|
96
|
+
mixcoreConfig.username,
|
|
97
|
+
mixcoreConfig.instance);
|
|
98
|
+
await mixcore.setHandleFFIs(mixcoreConfig.includes, mixcoreConfig.excludes);
|
|
99
|
+
localFFIs = {...localFFIs, ...mixcore.localFFIs()};
|
|
100
|
+
mixcoreConfig = null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (localFFIs) {
|
|
104
|
+
for (const [k, v] of Object.entries(localFFIs)) {
|
|
105
|
+
localFFIfuns[k] = {...v};
|
|
106
|
+
if (v.isRaw && (v.canFail || v.useJsonDecoder)) {
|
|
107
|
+
console.error("A raw, local FFI must neither be failing nor use the JSON decoder: " + k);
|
|
108
|
+
} else {
|
|
109
|
+
localFFIkind[k] = {...v};
|
|
110
|
+
delete localFFIkind[k].run;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
let vm_kind = { isRaw:false, canFail:false, useJsonDecoder:false};
|
|
114
|
+
localFFIkind["$vm_start"] = vm_kind;
|
|
115
|
+
localFFIfuns["$vm_start"] = ffi_vm_start;
|
|
116
|
+
localFFIkind["$vm_stop"] = vm_kind;
|
|
117
|
+
localFFIfuns["$vm_stop"] = ffi_vm_stop;
|
|
118
|
+
}
|
|
119
|
+
let config_msg =
|
|
120
|
+
{ "_rmx_type": "msg_vm_configure",
|
|
121
|
+
"baseURL": config.baseURL,
|
|
122
|
+
"org": config.org,
|
|
123
|
+
"workspace": config.workspace,
|
|
124
|
+
"vmID": config.vmID,
|
|
125
|
+
"user": config.user,
|
|
126
|
+
"token": config.token,
|
|
127
|
+
"hub": channel.port,
|
|
128
|
+
"outputViaMQTT": !(config.noOutputViaMQTT),
|
|
129
|
+
"machType": config.machType,
|
|
130
|
+
"debugMask": initialMask,
|
|
131
|
+
"localFFIs": localFFIkind,
|
|
132
|
+
"allowInsecureHttp": globalThis.GROOVEBOX_ALLOW_INSECURE_HTTP,
|
|
133
|
+
"interceptFFI": config.interceptFFI,
|
|
134
|
+
"interceptDynloadFFI": config.interceptDynloadFFI,
|
|
135
|
+
"mixcore": mixcoreConfig,
|
|
136
|
+
};
|
|
137
|
+
worker.postMessage(config_msg, [ channel.port ]);
|
|
138
|
+
if (localFFIs)
|
|
139
|
+
setupLocalFFIs(hub, config, localFFIfuns); // don't await!
|
|
140
|
+
return worker;
|
|
105
141
|
}
|
|
106
142
|
|
|
107
143
|
async function ffi_vm_start(conn, args) {
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "2194";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|