declare namespace IsolatedVM { export type Transferable = | null | undefined | string | number | boolean | Isolate | Context | Script | ExternalCopy | Callback | Copy | Reference | Dereference | Module | ((...args: any[]) => any) | typeof IsolatedVM; /** * This is the main reference to an isolate. Every handle to an isolate is transferable, which * means you can give isolates references to each other. An isolate will remain valid as long as * someone holds a handle to the isolate or anything created inside that isolate. Once an isolate * is lost the garbage collector should eventually find it and clean up its memory. Since an * isolate and all it contains can represent quite a large chunk of memory though you may want to * explicitly call the `dispose()` method on isolates that you are finished with to get that memory * back immediately. */ export class Isolate { private __ivm_isolate: undefined; constructor(options?: IsolateOptions); /** * The total CPU time spent in this isolate. CPU time is the amount of time the isolate has * spent actively doing work on the CPU. * * Note that CPU time may vary drastically if there is contention for the CPU. This could occur * if other processes are trying to do work, or if you have more than * require('os').cpus().length isolates currently doing work in the same nodejs process. */ readonly cpuTime: bigint; /** * Flag that indicates whether this isolate has been disposed. */ readonly isDisposed: boolean; /** * The total wall time spent in this isolate. Wall time is the amount of time the isolate has * been running, including passive time spent waiting (think "wall" like a clock on the wall). * For instance, if an isolate makes a call into another isolate, wall time will continue * increasing while CPU time will remain the same. */ readonly wallTime: bigint; /** * Returns the total count of active `Reference` instances that belong to this isolate. Note * that in certain cases many `Reference` instances in JavaScript will point to the same * underlying reference handle, in which case this number will only reflect the underlying * reference handle. This happens when you transfer a `Reference` instance via some method which * accepts transferable values. This will also include underlying reference handles created by * isolated-vm like `Script` or `Context` objects. */ readonly referenceCount: number; /** * Isolate snapshots are a very useful feature if you intend to create several isolates running * common libraries between them. A snapshot serializes the entire v8 heap including parsed code, * global variables, and compiled code. Check out the examples section for tips on using this. * * **Please note that versions of nodejs 10.4.0 - 10.9.0 may crash while using the snapshot * feature.** * * @param warmup_script - Optional script to "warmup" the snapshot by triggering code compilation */ static createSnapshot(scripts: SnapshotScriptInfo[], warmup_script?: string): ExternalCopy; compileScript(code: string, scriptInfo?: ScriptInfo): Promise