@remix_labs/machine-starter 2.3465.0-dev → 2.11723.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.
@@ -0,0 +1,647 @@
1
+
2
+ ;// ./src/mixcore-wasm-api.js
3
+ let MIXCORE_TRACE = false;
4
+
5
+ // JS interface to the Mixcore C-API implemented in
6
+ // `mix-rs:mixcore/src/c_api.rs`.
7
+ class MixcoreWasmApi {
8
+ // log: e.g. `info,mixcore=debug`
9
+ static async create(wasm, wasi, log) {
10
+ let wasmApi = new MixcoreWasmApi();
11
+ let imports = {
12
+ wasi_snapshot_preview1: wasi.wasiImport,
13
+ env: {
14
+ mixcore_http_request: wasmApi.httpRequest.bind(wasmApi),
15
+ mixcore_http_drop_response: wasmApi.httpDropResponse.bind(wasmApi),
16
+ mixcore_file_url: wasmApi.fileUrl.bind(wasmApi),
17
+ },
18
+ };
19
+ let instance = await WebAssembly.instantiate(wasm, imports);
20
+ if (instance.instance !== undefined) {
21
+ // does instantiate return an instance or {instance, module}
22
+ // depending on whether the module is a bytebuffer or a Wasm module?
23
+ instance = instance.instance;
24
+ }
25
+ wasi.inst = instance;
26
+ wasmApi.instance = instance;
27
+ wasmApi.mem = instance.exports.memory;
28
+ wasmApi.api = instance.exports; // Mixcore C-API
29
+ wasmApi.urls = {};
30
+ // get preopened wasi directory, only using bjorn's WASI shim
31
+ wasmApi.fs = wasi.fds ? wasi.fds[3] : null;
32
+ if (log) wasmApi.mixcoreInitLogging(log);
33
+ return wasmApi;
34
+ }
35
+
36
+ mixcoreInitLogging(log) {
37
+ if (log) {
38
+ this.callAPI("mixcore_init_logging", [log]);
39
+ }
40
+ }
41
+ mixcoreSetup(dbDir, dbName, user) {
42
+ let { result: ptr } = this.callAPI("mixcore_setup", [
43
+ dbDir,
44
+ dbName,
45
+ user,
46
+ JSON.stringify({ user }),
47
+ null,
48
+ null,
49
+ { kind: "error" },
50
+ ]);
51
+ return ptr;
52
+ }
53
+ initRemixFile(remixPath, dbPath, user) {
54
+ let { result: manifestJson } = this.callAPI(
55
+ "mixcore_init_remix_file",
56
+ [remixPath, dbPath, user, { kind: "error" }],
57
+ { result: { type: "string" } },
58
+ );
59
+ return JSON.parse(manifestJson);
60
+ }
61
+ initRemixFileBuffer(remixBuf, dbPath, user) {
62
+ let { result: manifestJson } = this.callAPI(
63
+ "mixcore_init_remix_file_buffer",
64
+ [remixBuf, remixBuf.byteLength, dbPath, user, { kind: "error" }],
65
+ { result: { type: "string" } },
66
+ );
67
+ return JSON.parse(manifestJson);
68
+ }
69
+ ffiNames(mixcorePtr) {
70
+ if (mixcorePtr === undefined)
71
+ throw new Error("mixcore-wasm-api: ffiNames requires mixcorePtr");
72
+ let {
73
+ out: { namesPtr, len },
74
+ } = this.callAPI("mixcore_ffi_names", [
75
+ mixcorePtr,
76
+ { kind: "error" },
77
+ { kind: "out", type: "word", name: "namesPtr" },
78
+ { kind: "out", type: "word", name: "len" },
79
+ ]);
80
+ let names = [];
81
+ for (let i = 0; i < len; i++) {
82
+ let ptr = this.readUint32(namesPtr + 4 * i);
83
+ let name = this.readString(ptr);
84
+ names.push(name);
85
+ }
86
+ this.callAPI("mixcore_ffi_names_drop", [namesPtr, len]);
87
+ return names;
88
+ }
89
+ async ffiDispatch(mixcorePtr, co, name, argsBuf) {
90
+ let { out } = this.callAPI("mixcore_ffi_dispatch", [
91
+ mixcorePtr,
92
+ co,
93
+ name,
94
+ argsBuf,
95
+ argsBuf.byteLength,
96
+ true,
97
+ { kind: "out", type: "bool", name: "ffiFound" },
98
+ { kind: "out", type: "bool", name: "isAsync" },
99
+ { kind: "out", type: "word", name: "resBufPtr" },
100
+ { kind: "out", type: "word", name: "resLen" },
101
+ { kind: "out", type: "string", name: "ffiErr" },
102
+ { kind: "out", type: "string", name: "mixErr" },
103
+ { kind: "out", type: "string", name: "mixBacktrace" },
104
+ { kind: "out", type: "string", name: "rawBacktrace" },
105
+ ]);
106
+ this.assert(out.ffiFound, "registered FFI found");
107
+ this.assert(!out.isAsync, "forced sync FFI dispatch");
108
+ if (out.ffiErr != null) {
109
+ throw new Error(`FFI ${name}: ${out.ffiErr}`);
110
+ }
111
+ if (out.mixErr != null) {
112
+ console.error("Mix error:", out.mixErr);
113
+ console.error(out.rawBacktrace);
114
+ console.error(out.mixBacktrace);
115
+ throw new Error(`Mix error: ${out.mixErr}`);
116
+ }
117
+ return this.readDropBuffer(out.resBufPtr, out.resLen);
118
+ }
119
+ mixcoreGetCodes(dbDir, dbName, standaloneName) {
120
+ let {
121
+ out: { codesPtr, count },
122
+ } = this.callAPI("mixcore_get_codes", [
123
+ dbDir,
124
+ dbName,
125
+ standaloneName,
126
+ false,
127
+ { kind: "error" },
128
+ { kind: "out", type: "word", name: "codesPtr" },
129
+ { kind: "out", type: "word", name: "count" },
130
+ ]);
131
+ let codes = [];
132
+ for (let i = 0; i < count; i++) {
133
+ let codePtr = codesPtr + i * 16;
134
+ let idPtr = this.readUint32(codePtr);
135
+ let bufPtr = this.readUint32(codePtr + 4);
136
+ let bufLen = this.readUint32(codePtr + 8);
137
+ let ondemandAppsPtr = this.readUint32(codePtr + 12);
138
+ let codeId = this.readString(idPtr);
139
+ let codeBuf = this.readUint8Buffer(bufPtr, bufLen);
140
+ let ondemandAppsStr = this.readString(ondemandAppsPtr);
141
+ let ondemandApps = ondemandAppsStr ? ondemandAppsStr.split(",") : [];
142
+ codes.push({ codeId, codeBuf, ondemandApps });
143
+ }
144
+ this.callAPI("mixcore_codes_drop", [codesPtr, count]);
145
+ return codes;
146
+ }
147
+ registerDebugObject(codeId, buf) {
148
+ this.callAPI("mixcore_register_debug_object", [
149
+ codeId,
150
+ buf,
151
+ buf.byteLength,
152
+ { kind: "error" },
153
+ ]);
154
+ }
155
+
156
+ /** `callAPI(fname, [arg1, ...], options)` calls the Wasm function called
157
+ * `fname`. The Wasm function may have input parameters and output parameters
158
+ * (as a pointer) and return a value. Input arguments `arg1`, ... are plain
159
+ * values of the following types:
160
+ *
161
+ * JS value | Wasm value
162
+ * ------------|-----------------
163
+ * null | 0
164
+ * 0xbeef | 0xbeef
165
+ * true/false | 1/0
166
+ * "string" | C-string pointer
167
+ * ArrayBuffer | u8 pointer
168
+ *
169
+ * Output parameters must be objects of the shape `{kind: "out", type: TYPE,
170
+ * name: NAME}`. The type may be `"string"`, `"word"`, or `"bool"`, and the
171
+ * name is a string.
172
+ *
173
+ * The result of the call is an object `{ result, out }` where `result` is the
174
+ * result of the Wasm call, and out is an object that maps the names of the
175
+ * out parameter to their values.
176
+ *
177
+ * A special parameter object is `{ kind: "error" }`, which triggers a
178
+ * Javascript error when the output parameter of the Wasm function points to a
179
+ * string and not null after the call.
180
+ *
181
+ * If `options.result === "string` the result of the Wasm function is read as a
182
+ * string if it is not 0.
183
+ */
184
+ callAPI(fname, args, options) {
185
+ let errObj = null;
186
+ let argObjs = args.map((arg, ix) => {
187
+ if (arg === null) {
188
+ return { kind: "in", type: "null", arg: 0 };
189
+ }
190
+ if (Number.isInteger(arg) && arg < 2 ** 32) {
191
+ return { kind: "in", type: "word", arg };
192
+ }
193
+ if (typeof arg === "boolean") {
194
+ return { kind: "in", type: "bool", arg: arg ? 1 : 0 };
195
+ } else if (typeof arg === "string") {
196
+ return { kind: "in", type: "string", arg: this.writeString(arg) };
197
+ } else if (arg instanceof Uint8Array) {
198
+ let ptr = this.allocate(arg.length);
199
+ let mem8 = new Uint8Array(this.mem.buffer);
200
+ mem8.set(arg, ptr);
201
+ return { kind: "in", type: "bytes", arg: ptr };
202
+ } else if (arg instanceof ArrayBuffer) {
203
+ let ptr = this.allocate(arg.byteLength);
204
+ let mem8 = new Uint8Array(this.mem.buffer);
205
+ mem8.set(new Uint8Array(arg), ptr);
206
+ return { kind: "in", type: "bytes", arg: ptr };
207
+ } else if (arg?.kind === "error") {
208
+ this.assert(errObj == null, "only one error output");
209
+ errObj = { kind: "error", arg: this.allocate(4) };
210
+ return errObj;
211
+ } else if (arg?.kind === "out") {
212
+ switch (arg.type) {
213
+ case "string":
214
+ return {
215
+ kind: "out",
216
+ type: "string",
217
+ name: arg.name,
218
+ arg: this.allocate(4),
219
+ };
220
+ case "bool":
221
+ return {
222
+ kind: "out",
223
+ type: "bool",
224
+ name: arg.name,
225
+ arg: this.allocate(1),
226
+ };
227
+ case "word":
228
+ return {
229
+ kind: "out",
230
+ type: "word",
231
+ name: arg.name,
232
+ arg: this.allocate(4),
233
+ };
234
+ default:
235
+ throw new Error(
236
+ `Unexpected type in argument ${ix} of ${fname}: ${arg.type}`,
237
+ );
238
+ }
239
+ } else {
240
+ throw new Error(
241
+ `Unexpected type or kind or value in argument ${ix} of ${fname} (type: ${typeof arg}, kind: ${arg?.kind})`,
242
+ );
243
+ }
244
+ });
245
+ let result = this.api[fname](...argObjs.map((v) => v.arg));
246
+ try {
247
+ if (errObj) {
248
+ let errPtr = this.readUint32(errObj.arg);
249
+ if (errPtr !== 0) {
250
+ let msg = this.readString(errPtr);
251
+ this.deallocate(errPtr);
252
+ throw new Error(`API error in ${fname}: ${msg}`);
253
+ }
254
+ }
255
+ let out = {};
256
+ for (let obj of argObjs.filter((o) => o.kind === "out")) {
257
+ if (!obj.name) {
258
+ throw new Error(`Missing name in out argument ${ix} of ${fname}`);
259
+ }
260
+ switch (obj.type) {
261
+ case "string":
262
+ let ptr = this.readUint32(obj.arg);
263
+ if (ptr === 0) {
264
+ out[obj.name] = null;
265
+ } else {
266
+ out[obj.name] = this.readDropString(ptr);
267
+ }
268
+ break;
269
+ case "bool":
270
+ out[obj.name] = this.readUint8(obj.arg) > 0;
271
+ break;
272
+ case "word":
273
+ out[obj.name] = this.readUint32(obj.arg);
274
+ break;
275
+ default:
276
+ throw new Error(
277
+ `Unexpected type in out argument ${ix} of ${fname}: ${obj.type}`,
278
+ );
279
+ }
280
+ }
281
+ if (options?.result?.type === "string") {
282
+ if (result === 0) {
283
+ result = null;
284
+ } else {
285
+ result = this.readDropString(result);
286
+ }
287
+ }
288
+ return { result, out };
289
+ } finally {
290
+ for (let obj of argObjs) {
291
+ switch (obj.kind) {
292
+ case "in":
293
+ switch (obj.type) {
294
+ case "string":
295
+ this.deallocate(obj.arg);
296
+ break;
297
+ case "bytes":
298
+ this.deallocate(obj.arg);
299
+ break;
300
+ }
301
+ break;
302
+ case "out":
303
+ this.deallocate(obj.arg);
304
+ }
305
+ }
306
+ }
307
+ }
308
+
309
+ /// reads a string from a pointer a pointer to a string, and deallocates the
310
+ /// string. returns `null` if the inner pointer is 0.
311
+ readDropString(ptr) {
312
+ if (ptr == 0) {
313
+ return null;
314
+ }
315
+ let res = this.readString(ptr);
316
+ this.deallocate(ptr);
317
+ return res;
318
+ }
319
+
320
+ readDropBytes(bytesPtr, len) {
321
+ let bytes = this.readUint8Buffer(bytesPtr, len);
322
+ this.api.mixcore_bytes_drop(bytesPtr, len);
323
+ return bytes;
324
+ }
325
+
326
+ readDropBuffer(bufPtr, len32) {
327
+ let res = new Uint8Array(this.mem.buffer).slice(bufPtr, bufPtr + len32 * 4);
328
+ this.api.mixcore_buffer_drop(bufPtr, len32);
329
+ return res;
330
+ }
331
+
332
+ assert(ok, msg) {
333
+ if (!ok) {
334
+ throw new Error(`This assertion was not met in MixCore: ${msg}`);
335
+ } else if (MIXCORE_TRACE && msg != "allocate") {
336
+ console.log(msg);
337
+ }
338
+ }
339
+
340
+ allocate(size) {
341
+ const res = this.api._rmx_allocate(size);
342
+ this.assert(res != 0, "allocate");
343
+ return res;
344
+ }
345
+
346
+ deallocate(ptr) {
347
+ this.api._rmx_deallocate(ptr);
348
+ }
349
+
350
+ writeString(str) {
351
+ const buf = new TextEncoder().encode(str);
352
+ const res = this.allocate(buf.length + 1);
353
+ const mem = new Uint8Array(this.mem.buffer, res, buf.length + 1);
354
+ mem.set(buf, 0);
355
+ mem[buf.length] = 0;
356
+ return res;
357
+ }
358
+
359
+ readUint8Buffer(ptr, len) {
360
+ return new Uint8Array(this.mem.buffer, ptr, len).slice();
361
+ }
362
+
363
+ writeUint8Buffer(buf) {
364
+ const res = this.allocate(buf.byteLength);
365
+ const mem = new Uint8Array(this.mem.buffer, res, buf.byteLength);
366
+ mem.set(buf, 0);
367
+ return res;
368
+ }
369
+
370
+ readString(ptr) {
371
+ const mem = new Uint8Array(this.mem.buffer, ptr);
372
+ const len = mem.findIndex((v) => v == 0);
373
+ this.assert(len != -1, "zero terminated string");
374
+ const buf = mem.subarray(0, len);
375
+ return new TextDecoder().decode(buf);
376
+ }
377
+
378
+ readUint32(ptr) {
379
+ const view = new DataView(this.mem.buffer);
380
+ return view.getUint32(ptr, true);
381
+ }
382
+
383
+ readUint8(ptr) {
384
+ const view = new DataView(this.mem.buffer);
385
+ return view.getUint8(ptr);
386
+ }
387
+
388
+ writeUint32(ptr, n) {
389
+ const view = new DataView(this.mem.buffer);
390
+ view.setUint32(ptr, n, true);
391
+ }
392
+
393
+ httpDropResponse(headersPtr, bodyPtr, bodyLen) {
394
+ this.deallocate(headersPtr);
395
+ this.deallocate(bodyPtr);
396
+ }
397
+
398
+ httpRequest(
399
+ reqUrl,
400
+ reqMethod,
401
+ reqHeaders,
402
+ reqBody,
403
+ reqBodyLen,
404
+ reqTimeoutMillis,
405
+ resStatus,
406
+ resHeaders,
407
+ resBody,
408
+ resBodyLen,
409
+ err,
410
+ ) {
411
+ let url = this.readString(reqUrl);
412
+ let method = this.readString(reqMethod);
413
+ let headers;
414
+ try {
415
+ headers = JSON.parse(this.readString(reqHeaders));
416
+ } catch (e) {
417
+ let errPtr = this.writeString("Could not parse headers: " + e);
418
+ this.writeUint32(err, errPtr);
419
+ return;
420
+ }
421
+ let body = null;
422
+ if (reqBody != 0) {
423
+ body = new Uint8Array(this.mem.buffer).subarray(
424
+ reqBody,
425
+ reqBody + reqBodyLen,
426
+ );
427
+ }
428
+ let req = new XMLHttpRequest(); // sync requests ftw
429
+ req.open(method, url, false);
430
+ for (let [name, value] of Object.entries(headers)) {
431
+ req.setRequestHeader(name, value);
432
+ }
433
+ if (reqTimeoutMillis) {
434
+ console.warn(
435
+ "ignore timeout for HTTP request (unsupported in sync XMLHTTPrequest in main thread",
436
+ );
437
+ }
438
+ req.send(body);
439
+ let response; // cannot force response type in XMLHttpRequest on main thread
440
+ if (req.response == null) {
441
+ response = null;
442
+ } else if (typeof req.response == "string") {
443
+ response = new TextEncoder().encode(req.response);
444
+ } else if (req.response.constructor == ArrayBuffer) {
445
+ response = req.response;
446
+ } else {
447
+ throw new Error(
448
+ `unexpected response, type ${typeof req.response}, construtor ${req.response.constructor?.name}`,
449
+ );
450
+ }
451
+ if (response == null) {
452
+ this.writeUint32(resBody, 0);
453
+ this.writeUint32(resBodyLen, 0);
454
+ } else {
455
+ let resBodyPtr = this.writeUint8Buffer(response);
456
+ this.writeUint32(resBody, resBodyPtr);
457
+ this.writeUint32(resBodyLen, response.byteLength);
458
+ }
459
+ let respHeaders = {};
460
+ for (let line of req
461
+ .getAllResponseHeaders()
462
+ .trim()
463
+ .split(/[\r\n]+/)) {
464
+ const parts = line.split(": ");
465
+ const header = parts.shift();
466
+ const value = parts.join(": ");
467
+ respHeaders[header] = value;
468
+ }
469
+ let resHeadersPtr = this.writeString(JSON.stringify(respHeaders));
470
+ this.writeUint32(resStatus, req.status);
471
+ this.writeUint32(resHeaders, resHeadersPtr);
472
+ this.writeUint32(err, 0);
473
+ }
474
+
475
+ // Note: filePath must be relative
476
+ fileUrl(filePath, url) {
477
+ if (this.fs && this.fs.dir) {
478
+ let pathStr = this.readString(filePath);
479
+ let path = { parts: pathStr.split("/"), is_dir: false };
480
+ let { entry: file, ret } = this.fs.dir.get_entry_for_path(path);
481
+ if (ret != 0) throw Error(`Could not get entry for ${pathStr}`);
482
+ // Using the file.data content as key in case the underlying file changes
483
+ if (file && file.data) {
484
+ let fname = pathStr.split("/").at(-1);
485
+ if (!(file.data in this.urls)) {
486
+ if (globalThis.ThisIsNode) {
487
+ this.urls[file.data] = "file:///" + file;
488
+ } else {
489
+ this.urls[file.data] = URL.createObjectURL(
490
+ new File([file.data], fname),
491
+ );
492
+ }
493
+ }
494
+ let urlptr = this.writeString(this.urls[file.data]);
495
+ this.writeUint32(url, urlptr);
496
+ }
497
+ }
498
+ }
499
+ }
500
+
501
+ function createWASI(wasi_shim, preopen, opts, env) {
502
+ let stdin = new wasi_shim.OpenFile(new wasi_shim.File([]));
503
+ let stdout = wasi_shim.ConsoleStdout.lineBuffered((msg) =>
504
+ console.log(`wasi: ${msg}`),
505
+ );
506
+ let stderr = wasi_shim.ConsoleStdout.lineBuffered((msg) =>
507
+ console.warn(`wasi: ${msg}`),
508
+ );
509
+ let fds = [stdin, stdout, stderr, preopen];
510
+ return new wasi_shim.WASI([], env ?? [], fds, opts ?? {});
511
+ }
512
+
513
+ ;// ./src/mixcore-base.ts
514
+ class Mixcore {
515
+ }
516
+
517
+ ;// ./src/mixcore-wasm.ts
518
+
519
+ // Mixcore FFI connector based on Wasm
520
+ class MixcoreWasm extends Mixcore {
521
+ constructor(mixcorePtr, wasmApi) {
522
+ super();
523
+ this.mixcorePtr = mixcorePtr;
524
+ this.wasmApi = wasmApi;
525
+ }
526
+ static create(dbDir, dbName, dbUser, wasmApi) {
527
+ let mixcorePtr = wasmApi.mixcoreSetup(dbDir, dbName, dbUser);
528
+ return new MixcoreWasm(mixcorePtr, wasmApi);
529
+ }
530
+ drop() {
531
+ this.wasmApi.mixcoreDrop(this.mixcorePtr);
532
+ }
533
+ // JS Mixcore API
534
+ async ffiNames() {
535
+ return this.wasmApi.ffiNames(this.mixcorePtr);
536
+ }
537
+ // JS Mixcore API
538
+ async ffiDispatch(co, name, argsBuf) {
539
+ return this.wasmApi.ffiDispatch(this.mixcorePtr, co, name, argsBuf);
540
+ }
541
+ getCodes(dbDir, dbName) {
542
+ return this.wasmApi.mixcoreGetCodes(dbDir, dbName);
543
+ }
544
+ // used in groovebox/machine-wasm/js/common.js
545
+ registerDebugObject(name, bytes) {
546
+ this.wasmApi.registerDebugObject(name, bytes);
547
+ }
548
+ }
549
+
550
+ ;// ./src/mixcore-tauri.ts
551
+
552
+ // don't depend on the tauri library
553
+ async function invoke(cmd, args) {
554
+ return await window.__TAURI__.core.invoke(cmd, args);
555
+ }
556
+ class MixcoreTauri extends Mixcore {
557
+ constructor(id) {
558
+ super();
559
+ this.id = id;
560
+ }
561
+ static async create(workspace, app) {
562
+ let id = (await invoke("mixcore_setup", { workspace, app }));
563
+ return new MixcoreTauri(id);
564
+ }
565
+ async ffiNames() {
566
+ return await invoke("mixcore_ffi_names", { id: this.id });
567
+ }
568
+ async ffiDispatch(co, name, argsBuf8) {
569
+ let argsBuf = Array.from(new Uint8Array(argsBuf8.buffer));
570
+ let resBuf = (await invoke("mixcore_ffi_dispatch", {
571
+ id: this.id,
572
+ co,
573
+ name,
574
+ argsBuf,
575
+ }));
576
+ return new Uint8Array(resBuf);
577
+ }
578
+ }
579
+
580
+ ;// ./src/mixcore-webkit.ts
581
+
582
+ async function handler(channel, msg) {
583
+ return await window.webkit.messageHandlers[channel].postMessage(msg);
584
+ }
585
+ class MixcoreWebkit extends Mixcore {
586
+ async ffiNames() {
587
+ return await handler("mixcore_ffi_names", {});
588
+ }
589
+ async ffiDispatch(co, name, argsBuf) {
590
+ return await handler("mixcore_ffi_dispatch", { co, name, argsBuf });
591
+ }
592
+ }
593
+
594
+ ;// ./src/ffi-filter.ts
595
+ // as long as we don't support better the dedicated groovebox setup
596
+ // (mixcore_setup_groovebox), we may need to filter the FFIs for use in
597
+ // groovebox
598
+ const CORE_FFI_NAMES = [
599
+ "$destroyHook",
600
+ "$hideHook",
601
+ "$isSyncEnabled",
602
+ "$loadHook",
603
+ "$flush",
604
+ "$showHook",
605
+ "$log",
606
+ "get_env",
607
+ "$outputError",
608
+ "$outputWithVersion",
609
+ "$co_sleep",
610
+ "$decodeError",
611
+ ];
612
+ function ffiNameMatches(name, pattern) {
613
+ if (pattern == "CORE") {
614
+ return CORE_FFI_NAMES.includes(name);
615
+ }
616
+ if (pattern.slice(-1) === "*") {
617
+ return name.startsWith(pattern.slice(0, -1));
618
+ }
619
+ return name === pattern;
620
+ }
621
+ function filterFFINames(names, enable, disable) {
622
+ if (enable !== undefined) {
623
+ names = names.filter((name) => enable.some((pat) => ffiNameMatches(name, pat)));
624
+ }
625
+ if (disable !== undefined) {
626
+ names = names.filter((name) => !disable.some((pat) => ffiNameMatches(name, pat)));
627
+ }
628
+ return names;
629
+ }
630
+
631
+ ;// ./src/mixcore.ts
632
+
633
+
634
+
635
+
636
+
637
+ async function dirName(dbName) {
638
+ let data = new TextEncoder().encode(dbName);
639
+ let digest = await crypto.subtle.digest("SHA-1", data);
640
+ return btoa(String.fromCharCode(...new Uint8Array(digest)))
641
+ .replace(/\+/g, "-")
642
+ .replace(/\//g, "_")
643
+ .replace(/\=+$/, "");
644
+ }
645
+
646
+
647
+ export { MixcoreTauri, MixcoreWasm, MixcoreWasmApi, MixcoreWebkit, createWASI, dirName, filterFFINames };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/machine-starter",
3
- "version": "2.3465.0-dev",
3
+ "version": "2.11723.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.3465.0-dev",
14
+ "@remix_labs/hub-client": "2.11723.0-dev",
15
15
  "nanoid": "^5.0.2",
16
16
  "web-worker": "^1.2.0"
17
17
  },