mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 00:39:56 +00:00
core: reduce memory pressure on startup from typescript import
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import ts, { ScriptTarget } from "typescript";
|
||||
import type { TranspileOptions } from "typescript";
|
||||
import sdk, { ScryptedDeviceBase, ScryptedInterface, ScryptedDeviceType } from "@scrypted/sdk";
|
||||
import vm from "vm";
|
||||
|
||||
const { systemManager, deviceManager, mediaManager, endpointManager } = sdk;
|
||||
|
||||
function tsCompile(source: string, options: ts.TranspileOptions = null): string {
|
||||
function tsCompile(source: string, options: TranspileOptions = null): string {
|
||||
const ts = require("typescript");
|
||||
const { ScriptTarget } = ts;
|
||||
|
||||
// Default options -- you could also perform a merge, or use the project tsconfig.json
|
||||
if (null === options) {
|
||||
options = {
|
||||
|
||||
4
plugins/core/package-lock.json
generated
4
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.167",
|
||||
"version": "0.0.168",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.167",
|
||||
"version": "0.0.168",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@koush/wrtc": "^0.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.167",
|
||||
"version": "0.0.168",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -39,8 +39,10 @@ aggregators.set(ScryptedInterface.Lock,
|
||||
values => values.reduce((prev, cur) => cur === LockState.Unlocked ? cur : prev, LockState.Locked));
|
||||
|
||||
|
||||
type AggregateCameraParsers = "mpegts";
|
||||
|
||||
function createVideoCamera(devices: VideoCamera[], console: Console): VideoCamera {
|
||||
let sessionPromise: Promise<FFMpegRebroadcastSession>
|
||||
let sessionPromise: Promise<FFMpegRebroadcastSession<AggregateCameraParsers>>
|
||||
|
||||
async function getVideoStreamWrapped(options: MediaStreamOptions) {
|
||||
if (sessionPromise) {
|
||||
|
||||
@@ -53,6 +53,7 @@ export class Scheduler {
|
||||
async setName() { },
|
||||
async setType() { },
|
||||
async setRoom() { },
|
||||
async probe() { return true },
|
||||
listen(event: EventListenerOptions, callback, source?: ScryptedDeviceBase) {
|
||||
function reschedule(): Date {
|
||||
const now = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user