@scrypted/server 0.115.1 → 0.115.3
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/deno/deno-plugin-remote.ts +5 -0
- package/dist/cluster/cluster-hash.js +1 -1
- package/dist/cluster/cluster-hash.js.map +1 -1
- package/dist/cluster/connect-rpc-object.d.ts +2 -1
- package/dist/plugin/plugin-api.d.ts +1 -0
- package/dist/plugin/plugin-console.js +4 -0
- package/dist/plugin/plugin-console.js.map +1 -1
- package/dist/plugin/plugin-remote-stats.js +19 -15
- package/dist/plugin/plugin-remote-stats.js.map +1 -1
- package/dist/plugin/plugin-remote-worker.js +77 -45
- package/dist/plugin/plugin-remote-worker.js.map +1 -1
- package/dist/plugin/runtime/child-process-worker.js +1 -1
- package/dist/plugin/runtime/child-process-worker.js.map +1 -1
- package/dist/plugin/runtime/deno-worker.d.ts +10 -0
- package/dist/plugin/runtime/deno-worker.js +79 -0
- package/dist/plugin/runtime/deno-worker.js.map +1 -0
- package/dist/plugin/runtime/node-fork-worker.d.ts +1 -1
- package/dist/plugin/runtime/node-fork-worker.js +2 -2
- package/dist/plugin/runtime/node-fork-worker.js.map +1 -1
- package/dist/plugin/runtime/node-thread-worker.d.ts +3 -3
- package/dist/plugin/runtime/node-thread-worker.js +22 -7
- package/dist/plugin/runtime/node-thread-worker.js.map +1 -1
- package/dist/plugin/runtime/python-worker.d.ts +0 -1
- package/dist/plugin/runtime/python-worker.js +0 -3
- package/dist/plugin/runtime/python-worker.js.map +1 -1
- package/dist/rpc-peer-eval.d.ts +4 -1
- package/dist/rpc-peer-eval.js +18 -15
- package/dist/rpc-peer-eval.js.map +1 -1
- package/dist/rpc.js +2 -2
- package/dist/rpc.js.map +1 -1
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -1
- package/dist/scrypted-main-exports.js +2 -2
- package/dist/scrypted-main-exports.js.map +1 -1
- package/dist/scrypted-main.js +4 -1
- package/dist/scrypted-main.js.map +1 -1
- package/dist/scrypted-plugin-main.js +14 -4
- package/dist/scrypted-plugin-main.js.map +1 -1
- package/package.json +4 -3
- package/python/plugin_remote.py +406 -218
- package/src/cluster/cluster-hash.ts +1 -1
- package/src/cluster/connect-rpc-object.ts +2 -1
- package/src/plugin/plugin-api.ts +1 -0
- package/src/plugin/plugin-console.ts +5 -0
- package/src/plugin/plugin-remote-stats.ts +20 -15
- package/src/plugin/plugin-remote-worker.ts +87 -47
- package/src/plugin/runtime/child-process-worker.ts +1 -1
- package/src/plugin/runtime/deno-worker.ts +83 -0
- package/src/plugin/runtime/node-fork-worker.ts +3 -5
- package/src/plugin/runtime/node-thread-worker.ts +22 -6
- package/src/plugin/runtime/python-worker.ts +0 -4
- package/src/rpc-peer-eval.ts +23 -19
- package/src/rpc.ts +3 -3
- package/src/runtime.ts +2 -0
- package/src/scrypted-main-exports.ts +2 -2
- package/src/scrypted-main.ts +4 -1
- package/src/scrypted-plugin-main.ts +14 -4
@@ -8,13 +8,14 @@ import { RpcMessage } from "./rpc";
|
|
8
8
|
|
9
9
|
function start(mainFilename: string) {
|
10
10
|
const pluginId = process.argv[3];
|
11
|
-
console.log('starting plugin', pluginId);
|
12
11
|
module.paths.push(getPluginNodePath(pluginId));
|
13
12
|
|
14
13
|
if (process.argv[2] === 'child-thread') {
|
15
|
-
|
14
|
+
console.log('starting thread', pluginId);
|
15
|
+
const { port } = worker_threads.workerData as { port: worker_threads.MessagePort };
|
16
|
+
const peer = startPluginRemote(mainFilename, pluginId, (message, reject) => {
|
16
17
|
try {
|
17
|
-
|
18
|
+
port.postMessage(v8.serialize(message));
|
18
19
|
}
|
19
20
|
catch (e) {
|
20
21
|
reject?.(e);
|
@@ -22,9 +23,18 @@ function start(mainFilename: string) {
|
|
22
23
|
});
|
23
24
|
peer.transportSafeArgumentTypes.add(Buffer.name);
|
24
25
|
peer.transportSafeArgumentTypes.add(Uint8Array.name);
|
25
|
-
|
26
|
+
port.on('message', message => peer.handleMessage(v8.deserialize(message)));
|
27
|
+
port.on('messageerror', e => {
|
28
|
+
console.error('message error', e);
|
29
|
+
process.exit(1);
|
30
|
+
});
|
31
|
+
port.on('close', () => {
|
32
|
+
console.error('port closed');
|
33
|
+
process.exit(1);
|
34
|
+
});
|
26
35
|
}
|
27
36
|
else {
|
37
|
+
console.log('starting plugin', pluginId);
|
28
38
|
const peer = startPluginRemote(mainFilename, process.argv[3], (message, reject, serializationContext) => process.send(message, serializationContext?.sendHandle, {
|
29
39
|
swallowErrors: !reject,
|
30
40
|
}, e => {
|