1 | declare module "vm" {
|
2 | interface Context {
|
3 | [key: string]: any;
|
4 | }
|
5 | interface BaseOptions {
|
6 | |
7 |
|
8 |
|
9 |
|
10 | filename?: string;
|
11 | |
12 |
|
13 |
|
14 |
|
15 | lineOffset?: number;
|
16 | |
17 |
|
18 |
|
19 |
|
20 | columnOffset?: number;
|
21 | }
|
22 | interface ScriptOptions extends BaseOptions {
|
23 | displayErrors?: boolean;
|
24 | timeout?: number;
|
25 | cachedData?: Buffer;
|
26 | produceCachedData?: boolean;
|
27 | }
|
28 | interface RunningScriptOptions extends BaseOptions {
|
29 | displayErrors?: boolean;
|
30 | timeout?: number;
|
31 | }
|
32 | interface CompileFunctionOptions extends BaseOptions {
|
33 | |
34 |
|
35 |
|
36 | cachedData?: Buffer;
|
37 | |
38 |
|
39 |
|
40 |
|
41 | produceCachedData?: boolean;
|
42 | |
43 |
|
44 |
|
45 | parsingContext?: Context;
|
46 |
|
47 | |
48 |
|
49 |
|
50 | contextExtensions?: Object[];
|
51 | }
|
52 | class Script {
|
53 | constructor(code: string, options?: ScriptOptions);
|
54 | runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
|
55 | runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
|
56 | runInThisContext(options?: RunningScriptOptions): any;
|
57 | }
|
58 | function createContext(sandbox?: Context): Context;
|
59 | function isContext(sandbox: Context): boolean;
|
60 | function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
|
61 | function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
|
62 | function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
|
63 | function compileFunction(code: string, params: string[], options: CompileFunctionOptions): Function;
|
64 | }
|