@basthon/kernel-base 0.78.5 → 0.78.6
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/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker/kernel-main.js +28 -26
- package/package.json +1 -1
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.78.
|
|
1
|
+
export declare const VERSION = "0.78.6";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.78.
|
|
1
|
+
export const VERSION = "0.78.6";
|
|
@@ -98,36 +98,38 @@ export class KernelMainBase extends KernelBase {
|
|
|
98
98
|
*/
|
|
99
99
|
async _start() {
|
|
100
100
|
await super._start();
|
|
101
|
-
await this.setRunningData(this._runningData);
|
|
102
|
-
// kernel restart in legacy mode is lazy, not a full restart
|
|
103
101
|
if (this.isLegacy() && this.remote != null) {
|
|
102
|
+
// kernel restart in legacy mode is lazy, not a full restart
|
|
104
103
|
await this.remote?.legacyStart();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// setup the proxy worker
|
|
108
|
-
const proxyWorker = new Worker(new URL("./comlink-proxy.js", import.meta.url));
|
|
109
|
-
const proxy = wrap(proxyWorker);
|
|
110
|
-
// setup the kernel worker
|
|
111
|
-
await this.setupWorker();
|
|
112
|
-
// always set... but not always useful
|
|
113
|
-
await this.remote?.setEphemeralAPI(this._ephemeralAPI);
|
|
114
|
-
if (this.syncCommSupport()) {
|
|
115
|
-
console.log("Using SharedArrayBuffer for synchronous worker communication.");
|
|
116
|
-
await this._remote?.setSAB(this._sab);
|
|
117
104
|
}
|
|
118
|
-
else
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
105
|
+
else {
|
|
106
|
+
// setup the proxy worker
|
|
107
|
+
const proxyWorker = new Worker(new URL("./comlink-proxy.js", import.meta.url));
|
|
108
|
+
const proxy = wrap(proxyWorker);
|
|
109
|
+
// setup the kernel worker
|
|
110
|
+
await this.setupWorker();
|
|
111
|
+
// always set... but not always useful
|
|
112
|
+
await this.remote?.setEphemeralAPI(this._ephemeralAPI);
|
|
113
|
+
if (this.syncCommSupport()) {
|
|
114
|
+
console.log("Using SharedArrayBuffer for synchronous worker communication.");
|
|
115
|
+
await this._remote?.setSAB(this._sab);
|
|
116
|
+
}
|
|
117
|
+
else if (this._fallbackKey != null) {
|
|
118
|
+
console.warn("SharedArrayBuffer not available, falling back to " +
|
|
119
|
+
"using third-party server for synchronous worker communication.");
|
|
120
|
+
const pass = globalThis.crypto.randomUUID();
|
|
121
|
+
await this.remote?.setFallbackKeyAndPass(this._fallbackKey, pass);
|
|
122
|
+
const AES = await import("crypto-js/aes");
|
|
123
|
+
this._encrypt = (message) => AES.encrypt(message, pass).toString();
|
|
124
|
+
}
|
|
125
|
+
// bind ports
|
|
126
|
+
const port = await proxy[createEndpoint]();
|
|
127
|
+
await this.remote?.setProxyPort(transfer(port, [port]));
|
|
128
|
+
// init remote
|
|
129
|
+
await this.remote?.init();
|
|
125
130
|
}
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
await this.remote?.setProxyPort(transfer(port, [port]));
|
|
129
|
-
// init remote
|
|
130
|
-
await this.remote?.init();
|
|
131
|
+
// restore running data (if any) in the kernel worker
|
|
132
|
+
await this.setRunningData(this._runningData);
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Comlink remote getter.
|