@scrypted/server 0.1.5 → 0.1.8
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.
Potentially problematic release.
This version of @scrypted/server might be problematic. Click here for more details.
- package/dist/listen-zero.js +38 -0
- package/dist/listen-zero.js.map +1 -0
- package/dist/plugin/media.js +1 -1
- package/dist/plugin/media.js.map +1 -1
- package/dist/plugin/plugin-console.js +1 -1
- package/dist/plugin/plugin-console.js.map +1 -1
- package/dist/plugin/plugin-host.js +33 -45
- package/dist/plugin/plugin-host.js.map +1 -1
- package/dist/plugin/plugin-http.js +7 -2
- package/dist/plugin/plugin-http.js.map +1 -1
- package/dist/plugin/plugin-npm-dependencies.js +3 -1
- package/dist/plugin/plugin-npm-dependencies.js.map +1 -1
- package/dist/plugin/plugin-repl.js +1 -1
- package/dist/plugin/plugin-repl.js.map +1 -1
- package/dist/plugin/runtime/node-fork-worker.js +8 -1
- package/dist/plugin/runtime/node-fork-worker.js.map +1 -1
- package/dist/rpc-serializer.js +121 -0
- package/dist/rpc-serializer.js.map +1 -0
- package/dist/runtime.js +2 -38
- package/dist/runtime.js.map +1 -1
- package/dist/scrypted-server-main.js +13 -11
- package/dist/scrypted-server-main.js.map +1 -1
- package/dist/services/plugin.js +4 -10
- package/dist/services/plugin.js.map +1 -1
- package/dist/threading.js +6 -28
- package/dist/threading.js.map +1 -1
- package/package.json +1 -1
- package/src/listen-zero.ts +34 -0
- package/src/plugin/media.ts +1 -1
- package/src/plugin/plugin-console.ts +1 -1
- package/src/plugin/plugin-host.ts +42 -43
- package/src/plugin/plugin-http.ts +8 -3
- package/src/plugin/plugin-npm-dependencies.ts +3 -1
- package/src/plugin/plugin-repl.ts +1 -1
- package/src/plugin/runtime/node-fork-worker.ts +8 -1
- package/src/plugin/runtime/runtime-worker.ts +2 -1
- package/src/rpc-serializer.ts +141 -0
- package/src/runtime.ts +3 -43
- package/src/scrypted-server-main.ts +16 -12
- package/src/services/plugin.ts +4 -10
- package/src/threading.ts +8 -35
- package/test/rpc-duplex-test.ts +30 -0
- package/test/threading-test.ts +29 -0
- package/dist/plugin/listen-zero.js +0 -23
- package/dist/plugin/listen-zero.js.map +0 -1
- package/src/plugin/listen-zero.ts +0 -21
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.listenZeroExpress = exports.listenZero = void 0;
|
4
|
-
const events_1 = require("events");
|
5
|
-
async function listenZero(server) {
|
6
|
-
server.listen(0);
|
7
|
-
await (0, events_1.once)(server, 'listening');
|
8
|
-
return server.address().port;
|
9
|
-
}
|
10
|
-
exports.listenZero = listenZero;
|
11
|
-
function listenZeroExpress(app) {
|
12
|
-
const server = app.listen(0);
|
13
|
-
return {
|
14
|
-
server,
|
15
|
-
port: (async () => {
|
16
|
-
await (0, events_1.once)(server, 'listening');
|
17
|
-
const { port } = server.address();
|
18
|
-
return port;
|
19
|
-
})()
|
20
|
-
};
|
21
|
-
}
|
22
|
-
exports.listenZeroExpress = listenZeroExpress;
|
23
|
-
//# sourceMappingURL=listen-zero.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"listen-zero.js","sourceRoot":"","sources":["../../src/plugin/listen-zero.ts"],"names":[],"mappings":";;;AACA,mCAA8B;AAGvB,KAAK,UAAU,UAAU,CAAC,MAAkB;IAC/C,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,IAAA,aAAI,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChC,OAAQ,MAAM,CAAC,OAAO,EAAsB,CAAC,IAAI,CAAC;AACtD,CAAC;AAJD,gCAIC;AAED,SAAgB,iBAAiB,CAAC,GAAoB;IAClD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO;QACH,MAAM;QACN,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE;YACd,MAAM,IAAA,aAAI,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAChC,MAAM,EAAE,IAAI,EAAE,GAAI,MAAM,CAAC,OAAO,EAAsB,CAAC;YACvD,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,EAAE;KACP,CAAA;AACL,CAAC;AAVD,8CAUC"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import net from 'net';
|
2
|
-
import { once } from 'events';
|
3
|
-
import express from 'express';
|
4
|
-
|
5
|
-
export async function listenZero(server: net.Server) {
|
6
|
-
server.listen(0);
|
7
|
-
await once(server, 'listening');
|
8
|
-
return (server.address() as net.AddressInfo).port;
|
9
|
-
}
|
10
|
-
|
11
|
-
export function listenZeroExpress(app: express.Express) {
|
12
|
-
const server = app.listen(0);
|
13
|
-
return {
|
14
|
-
server,
|
15
|
-
port: (async () => {
|
16
|
-
await once(server, 'listening');
|
17
|
-
const { port } = (server.address() as net.AddressInfo);
|
18
|
-
return port;
|
19
|
-
})()
|
20
|
-
}
|
21
|
-
}
|