@supraio/client-daemon-js 0.0.1-mz-warmup.1 → 0.0.1-mz-warmup.2
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/daemon/wasm.d.ts +0 -9
- package/daemon.js +15 -6
- package/daemon.js.map +2 -2
- package/go/go.d.ts +9 -0
- package/package.json +1 -1
- package/screen/wasm.d.ts +0 -5
- package/screen.js +15 -6
- package/screen.js.map +2 -2
- package/sdk.js +17 -12
- package/sdk.js.map +2 -2
- package/supra-client-daemon.js +14 -14
- package/supra-client-daemon.wasm +0 -0
- package/supra-client-screen.js +16 -16
- package/supra-client-screen.wasm +0 -0
package/go/go.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import nodeFs from 'fs';
|
|
1
3
|
declare global {
|
|
2
4
|
class Go {
|
|
3
5
|
/** Accessed by x264/decode_wasm.go directly to optimize memory usage */
|
|
@@ -9,8 +11,15 @@ declare global {
|
|
|
9
11
|
argv: string[];
|
|
10
12
|
run(instance: WebAssembly.Instance): Promise<void>;
|
|
11
13
|
}
|
|
14
|
+
interface Window {
|
|
15
|
+
/** Make it global accessible for wasm_exec.js */
|
|
16
|
+
fs: typeof nodeFs;
|
|
17
|
+
module: any;
|
|
18
|
+
Go: new () => Go;
|
|
19
|
+
}
|
|
12
20
|
}
|
|
13
21
|
export declare function getGoEnv(): {
|
|
14
22
|
HOME: string;
|
|
15
23
|
USER: string;
|
|
16
24
|
};
|
|
25
|
+
export declare function initGoEnvironment(): Promise<void>;
|
package/package.json
CHANGED
package/screen/wasm.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import '../go/go';
|
|
3
2
|
import { H264Decoder } from 'h264decoder';
|
|
4
|
-
import nodeFs from 'fs';
|
|
5
3
|
import { IScreenOptions } from './options';
|
|
6
4
|
declare global {
|
|
7
5
|
interface Window {
|
|
8
6
|
/** Make it global accessible for x264/decode_wasm.go */
|
|
9
7
|
h264Decoder: H264Decoder;
|
|
10
|
-
/** Make it global accessible for wasm_exec.js */
|
|
11
|
-
fs: typeof nodeFs;
|
|
12
|
-
module: any;
|
|
13
8
|
}
|
|
14
9
|
}
|
|
15
10
|
export declare function startWasmScreen(options?: IScreenOptions): Promise<void>;
|
package/screen.js
CHANGED
|
@@ -17275,12 +17275,25 @@
|
|
|
17275
17275
|
}
|
|
17276
17276
|
|
|
17277
17277
|
// go/go.ts
|
|
17278
|
+
var WASM_EXEC_URL = "wasm_exec.js";
|
|
17278
17279
|
function getGoEnv() {
|
|
17279
17280
|
return {
|
|
17280
17281
|
HOME: "/",
|
|
17281
17282
|
USER: "unknown"
|
|
17282
17283
|
};
|
|
17283
17284
|
}
|
|
17285
|
+
async function initGoEnvironment() {
|
|
17286
|
+
if (!window.fs) {
|
|
17287
|
+
const fs = await initBrowserFS();
|
|
17288
|
+
window.fs = fs;
|
|
17289
|
+
}
|
|
17290
|
+
if (!window.module) {
|
|
17291
|
+
window.module = {};
|
|
17292
|
+
}
|
|
17293
|
+
if (!window.Go) {
|
|
17294
|
+
await injectScript(WASM_EXEC_URL);
|
|
17295
|
+
}
|
|
17296
|
+
}
|
|
17284
17297
|
|
|
17285
17298
|
// screen/plain.ts
|
|
17286
17299
|
var SCREEN_JS_URL = "supra-client-screen.js";
|
|
@@ -17431,15 +17444,11 @@
|
|
|
17431
17444
|
|
|
17432
17445
|
// screen/wasm.ts
|
|
17433
17446
|
var SCREEN_WASM_URL = "supra-client-screen.wasm";
|
|
17434
|
-
var WASM_EXEC_URL = "wasm_exec.js";
|
|
17435
17447
|
async function startWasmScreen(options) {
|
|
17436
17448
|
const screenOptions = options ?? parseQueryOptions();
|
|
17437
|
-
const fs = await initBrowserFS();
|
|
17438
17449
|
const h264Decoder = await createH264Decoder();
|
|
17439
17450
|
window.h264Decoder = h264Decoder;
|
|
17440
|
-
|
|
17441
|
-
window.module = {};
|
|
17442
|
-
await injectScript(WASM_EXEC_URL);
|
|
17451
|
+
await initGoEnvironment();
|
|
17443
17452
|
await startGoScreen(h264Decoder, screenOptions);
|
|
17444
17453
|
}
|
|
17445
17454
|
function parseQueryOptions() {
|
|
@@ -17476,7 +17485,7 @@
|
|
|
17476
17485
|
return h264Decoder;
|
|
17477
17486
|
}
|
|
17478
17487
|
async function startGoScreen(h264Decoder, options) {
|
|
17479
|
-
const go = new Go();
|
|
17488
|
+
const go = new window.Go();
|
|
17480
17489
|
go.h264 = h264Decoder.memory;
|
|
17481
17490
|
const result = await WebAssembly.instantiateStreaming(fetch(SCREEN_WASM_URL), go.importObject);
|
|
17482
17491
|
go.env = getGoEnv();
|