@milaboratories/pframes-rs-wasm 0.1.0 → 0.1.1
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.
|
Binary file
|
|
@@ -1857,9 +1857,17 @@ const _typeCheckAsyncFn= (f) => {
|
|
|
1857
1857
|
|
|
1858
1858
|
const ASYNC_FN_CTOR = (async () => {}).constructor;
|
|
1859
1859
|
|
|
1860
|
-
const base64Compile = str => WebAssembly.compile(Uint8Array.from(atob(str), b => b.charCodeAt(0)));
|
|
1860
|
+
const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
|
|
1861
1861
|
|
|
1862
|
-
const
|
|
1862
|
+
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
1863
|
+
let _fs;
|
|
1864
|
+
async function fetchCompile (url) {
|
|
1865
|
+
if (isNode) {
|
|
1866
|
+
_fs = _fs || await import('node:fs/promises');
|
|
1867
|
+
return WebAssembly.compile(await _fs.readFile(url));
|
|
1868
|
+
}
|
|
1869
|
+
return fetch(url).then(WebAssembly.compileStreaming);
|
|
1870
|
+
}
|
|
1863
1871
|
|
|
1864
1872
|
const symbolCabiDispose = Symbol.for('cabiDispose');
|
|
1865
1873
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pframes-rs-wasm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"generated",
|
|
6
6
|
"src"
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@bytecodealliance/jco": "^1.16.1",
|
|
14
14
|
"@bytecodealliance/preview2-shim": "0.17.8",
|
|
15
|
-
"@milaboratories/pl-model-common": "1.24.
|
|
16
|
-
"@milaboratories/pl-model-middle-layer": "1.11.
|
|
15
|
+
"@milaboratories/pl-model-common": "1.24.6",
|
|
16
|
+
"@milaboratories/pl-model-middle-layer": "1.11.8",
|
|
17
17
|
"@milaboratories/ts-configs": "1.2.0",
|
|
18
18
|
"rimraf": "^6.1.2",
|
|
19
19
|
"typescript": "^5.9.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@bytecodealliance/preview2-shim": "0.17.8",
|
|
23
|
-
"@milaboratories/pl-model-common": "1.24.
|
|
24
|
-
"@milaboratories/pl-model-middle-layer": "1.11.
|
|
23
|
+
"@milaboratories/pl-model-common": "1.24.6",
|
|
24
|
+
"@milaboratories/pl-model-middle-layer": "1.11.8"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"component-transpile": "rimraf generated && jco transpile -o generated --no-
|
|
27
|
+
"component-transpile": "rimraf generated && jco transpile -o generated --no-namespaced-exports",
|
|
28
28
|
"build:rust": "cargo build",
|
|
29
29
|
"build:ts": "node --run component-transpile -- ../../target/wasm32-wasip2/debug/pframes_rs_wasm.wasm",
|
|
30
30
|
"build": "node --run build:rust && node --run build:ts",
|
package/src/p-frame.ts
CHANGED
|
@@ -10,15 +10,9 @@ import { spec as bindings } from '../generated/pframes_rs_wasm.js';
|
|
|
10
10
|
|
|
11
11
|
export class PFrame implements PFrameInternal.PFrameWasm {
|
|
12
12
|
#frame: bindings.Frame;
|
|
13
|
-
#disposables: DisposableStack;
|
|
14
13
|
|
|
15
14
|
constructor(spec: Record<string, PColumnSpec>) {
|
|
16
|
-
using disposer = new DisposableStack();
|
|
17
15
|
this.#frame = bindings.Frame.fromJson(JSON.stringify(spec));
|
|
18
|
-
// Unfortunately, jco generates incorrect types
|
|
19
|
-
// actual spec.PFrame is indeed Disposable
|
|
20
|
-
disposer.use(this.#frame as unknown as Disposable);
|
|
21
|
-
this.#disposables = disposer.move();
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
deleteColumns(
|
|
@@ -45,7 +39,9 @@ export class PFrame implements PFrameInternal.PFrameWasm {
|
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
[Symbol.dispose](): void {
|
|
48
|
-
|
|
42
|
+
// Unfortunately, jco generates incorrect types
|
|
43
|
+
// actual spec.PFrame is indeed Disposable
|
|
44
|
+
(this.#frame as unknown as Disposable)[Symbol.dispose]();
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
|