/
vm.ts
83 lines (67 loc) · 1.52 KB
/
vm.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
import { notImplemented } from "./_utils.ts";
export class Script {
code: string;
constructor(code: string, _options = {}) {
this.code = `${code}`;
}
runInThisContext(_options: any) {
return eval.call(globalThis, this.code);
}
runInContext(_contextifiedObject: any, _options: any) {
notImplemented();
}
runInNewContext(_contextObject: any, _options: any) {
notImplemented();
}
createCachedData() {
notImplemented();
}
}
export function createContext(_contextObject: any, _options: any) {
notImplemented();
}
export function createScript(code: string, options: any) {
return new Script(code, options);
}
export function runInContext(
_code: string,
_contextifiedObject: any,
_options: any,
) {
notImplemented();
}
export function runInNewContext(
_code: string,
_contextObject: any,
_options: any,
) {
notImplemented();
}
export function runInThisContext(
code: string,
options: any,
) {
return createScript(code, options).runInThisContext(options);
}
export function isContext(_maybeContext: any) {
notImplemented();
}
export function compileFunction(_code: string, _params: any, _options: any) {
notImplemented();
}
export function measureMemory(_options: any) {
notImplemented();
}
export default {
Script,
createContext,
createScript,
runInContext,
runInNewContext,
runInThisContext,
isContext,
compileFunction,
measureMemory,
};