@scrypted/server 0.7.18 → 0.7.20
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/scrypted-main.js +10 -2
- package/dist/scrypted-main.js.map +1 -1
- package/package.json +1 -1
- package/src/scrypted-main.ts +13 -2
package/dist/scrypted-main.js
CHANGED
@@ -3,10 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const v8_1 = __importDefault(require("v8"));
|
7
|
+
const vm_1 = __importDefault(require("vm"));
|
6
8
|
const process_1 = __importDefault(require("process"));
|
7
9
|
const semver_1 = __importDefault(require("semver"));
|
8
10
|
const rpc_1 = require("./rpc");
|
9
11
|
const plugin_error_1 = require("./plugin/plugin-error");
|
12
|
+
if (!global.gc) {
|
13
|
+
v8_1.default.setFlagsFromString('--expose_gc');
|
14
|
+
global.gc = vm_1.default.runInNewContext("gc");
|
15
|
+
}
|
10
16
|
if (!semver_1.default.gte(process_1.default.version, '16.0.0')) {
|
11
17
|
throw new Error('"node" version out of date. Please update node to v16 or higher.');
|
12
18
|
}
|
@@ -16,6 +22,7 @@ if (!semver_1.default.gte(process_1.default.version, '16.0.0')) {
|
|
16
22
|
// The workaround is to favor IPv4.
|
17
23
|
process_1.default.env['NODE_OPTIONS'] = '--dns-result-order=ipv4first';
|
18
24
|
(0, rpc_1.startPeriodicGarbageCollection)();
|
25
|
+
let startPromise;
|
19
26
|
if (process_1.default.argv[2] === 'child' || process_1.default.argv[2] === 'child-thread') {
|
20
27
|
// plugins should never crash. this handler will be removed, and then readded
|
21
28
|
// after the plugin source map is retrieved.
|
@@ -26,7 +33,7 @@ if (process_1.default.argv[2] === 'child' || process_1.default.argv[2] === 'chil
|
|
26
33
|
console.error('unhandledRejection', e);
|
27
34
|
});
|
28
35
|
const start = require('./scrypted-plugin-main').default;
|
29
|
-
start(__filename);
|
36
|
+
startPromise = start(__filename);
|
30
37
|
}
|
31
38
|
else {
|
32
39
|
// unhandled rejections are allowed if they are from a rpc/plugin call.
|
@@ -38,6 +45,7 @@ else {
|
|
38
45
|
console.warn('unhandled rejection of RPC Result', error);
|
39
46
|
});
|
40
47
|
const start = require('./scrypted-server-main').default;
|
41
|
-
start(__filename);
|
48
|
+
startPromise = start(__filename);
|
42
49
|
}
|
50
|
+
exports.default = startPromise;
|
43
51
|
//# sourceMappingURL=scrypted-main.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scrypted-main.js","sourceRoot":"","sources":["../src/scrypted-main.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAC9B,oDAA4B;AAC5B,+BAAuE;AACvE,wDAAoD;AAEpD,IAAI,CAAC,gBAAM,CAAC,GAAG,CAAC,iBAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;IACxC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;CACtF;AAED,uEAAuE;AACvE,uEAAuE;AACvE,6DAA6D;AAC7D,mCAAmC;AACnC,iBAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,8BAA8B,CAAC;AAE7D,IAAA,oCAA8B,GAAE,CAAC;AAEjC,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE;IACnE,6EAA6E;IAC7E,4CAA4C;IAC5C,iBAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE;QAChC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,iBAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE;QACjC,OAAO,CAAC,K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AAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC;IACxD,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;CACpC;KACI;IACD,uEAAuE;IACvE,iBAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC,EAAE;QACrC,IAAI,KAAK,EAAE,WAAW,KAAK,oBAAc,IAAI,KAAK,EAAE,WAAW,KAAK,0BAAW,EAAE;YAC7E,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5B,MAAM,KAAK,CAAC;SACf;QACD,OAAO,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC;IACxD,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;CACpC;AAED,kBAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
package/src/scrypted-main.ts
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
import v8 from 'v8';
|
2
|
+
import vm from 'vm';
|
1
3
|
import process from 'process';
|
2
4
|
import semver from 'semver';
|
3
5
|
import { RPCResultError, startPeriodicGarbageCollection } from './rpc';
|
4
6
|
import { PluginError } from './plugin/plugin-error';
|
5
7
|
|
8
|
+
if (!global.gc) {
|
9
|
+
v8.setFlagsFromString('--expose_gc')
|
10
|
+
global.gc = vm.runInNewContext("gc");
|
11
|
+
}
|
12
|
+
|
6
13
|
if (!semver.gte(process.version, '16.0.0')) {
|
7
14
|
throw new Error('"node" version out of date. Please update node to v16 or higher.')
|
8
15
|
}
|
@@ -15,6 +22,8 @@ process.env['NODE_OPTIONS'] = '--dns-result-order=ipv4first';
|
|
15
22
|
|
16
23
|
startPeriodicGarbageCollection();
|
17
24
|
|
25
|
+
let startPromise: any;
|
26
|
+
|
18
27
|
if (process.argv[2] === 'child' || process.argv[2] === 'child-thread') {
|
19
28
|
// plugins should never crash. this handler will be removed, and then readded
|
20
29
|
// after the plugin source map is retrieved.
|
@@ -26,7 +35,7 @@ if (process.argv[2] === 'child' || process.argv[2] === 'child-thread') {
|
|
26
35
|
});
|
27
36
|
|
28
37
|
const start = require('./scrypted-plugin-main').default;
|
29
|
-
start(__filename);
|
38
|
+
startPromise = start(__filename);
|
30
39
|
}
|
31
40
|
else {
|
32
41
|
// unhandled rejections are allowed if they are from a rpc/plugin call.
|
@@ -39,5 +48,7 @@ else {
|
|
39
48
|
});
|
40
49
|
|
41
50
|
const start = require('./scrypted-server-main').default;
|
42
|
-
start(__filename);
|
51
|
+
startPromise = start(__filename);
|
43
52
|
}
|
53
|
+
|
54
|
+
export default startPromise;
|