@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.
Files changed (46) hide show
  1. package/dist/listen-zero.js +38 -0
  2. package/dist/listen-zero.js.map +1 -0
  3. package/dist/plugin/media.js +1 -1
  4. package/dist/plugin/media.js.map +1 -1
  5. package/dist/plugin/plugin-console.js +1 -1
  6. package/dist/plugin/plugin-console.js.map +1 -1
  7. package/dist/plugin/plugin-host.js +33 -45
  8. package/dist/plugin/plugin-host.js.map +1 -1
  9. package/dist/plugin/plugin-http.js +7 -2
  10. package/dist/plugin/plugin-http.js.map +1 -1
  11. package/dist/plugin/plugin-npm-dependencies.js +3 -1
  12. package/dist/plugin/plugin-npm-dependencies.js.map +1 -1
  13. package/dist/plugin/plugin-repl.js +1 -1
  14. package/dist/plugin/plugin-repl.js.map +1 -1
  15. package/dist/plugin/runtime/node-fork-worker.js +8 -1
  16. package/dist/plugin/runtime/node-fork-worker.js.map +1 -1
  17. package/dist/rpc-serializer.js +121 -0
  18. package/dist/rpc-serializer.js.map +1 -0
  19. package/dist/runtime.js +2 -38
  20. package/dist/runtime.js.map +1 -1
  21. package/dist/scrypted-server-main.js +13 -11
  22. package/dist/scrypted-server-main.js.map +1 -1
  23. package/dist/services/plugin.js +4 -10
  24. package/dist/services/plugin.js.map +1 -1
  25. package/dist/threading.js +6 -28
  26. package/dist/threading.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/listen-zero.ts +34 -0
  29. package/src/plugin/media.ts +1 -1
  30. package/src/plugin/plugin-console.ts +1 -1
  31. package/src/plugin/plugin-host.ts +42 -43
  32. package/src/plugin/plugin-http.ts +8 -3
  33. package/src/plugin/plugin-npm-dependencies.ts +3 -1
  34. package/src/plugin/plugin-repl.ts +1 -1
  35. package/src/plugin/runtime/node-fork-worker.ts +8 -1
  36. package/src/plugin/runtime/runtime-worker.ts +2 -1
  37. package/src/rpc-serializer.ts +141 -0
  38. package/src/runtime.ts +3 -43
  39. package/src/scrypted-server-main.ts +16 -12
  40. package/src/services/plugin.ts +4 -10
  41. package/src/threading.ts +8 -35
  42. package/test/rpc-duplex-test.ts +30 -0
  43. package/test/threading-test.ts +29 -0
  44. package/dist/plugin/listen-zero.js +0 -23
  45. package/dist/plugin/listen-zero.js.map +0 -1
  46. 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
- }