-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmetavm.d.ts
44 lines (36 loc) · 919 Bytes
/
metavm.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Context, Script, ScriptOptions, BaseOptions } from 'node:vm';
export const EMPTY_CONTEXT: Context;
export const COMMON_CONTEXT: Context;
export const NODE_CONTEXT: Context;
export class MetavmError extends Error {}
export function createContext(
context?: Context,
preventEscape?: boolean,
): Context;
declare enum ModuleType {
METARHIA = 1,
COMMONJS = 2,
}
export interface MetaScriptOptions extends ScriptOptions {
type?: ModuleType;
dirname?: string;
relative?: string;
context?: Context;
access?: object;
}
export class MetaScript {
constructor(name: string, src: string, options?: MetaScriptOptions);
name: string;
script: Script;
context: Context;
exports: any;
}
export function createScript(
name: string,
src: string,
options?: MetaScriptOptions,
): MetaScript;
export function readScript(
filePath: string,
options?: BaseOptions,
): Promise<MetaScript>;