MCPcopy
hub / github.com/patriksimek/vm2 / VMOptions

Interface VMOptions

index.d.ts:135–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 * Options for creating a VM
134 */
135export interface VMOptions {
136 /**
137 * `javascript` (default), `typescript`, `coffeescript` or custom compiler function (which receives the code, and it's file path).
138 * The library expects you to have compiler pre-installed if the value is set to `typescript` or `coffeescript`.
139 */
140 compiler?: "javascript" | "typescript" | "coffeescript" | CompilerFunction;
141 /**
142 * Compiler options.
143 */
144 compilerOptions?: Record<string, any>;
145 /** VM's global object. */
146 sandbox?: any;
147 /**
148 * Script timeout in milliseconds. Timeout is only effective on code you run through `run`.
149 * Timeout is NOT effective on any method returned by VM.
150 */
151 timeout?: number;
152 /**
153 * If set to `false` any calls to eval or function constructors (`Function`, `GeneratorFunction`, etc.) will throw an
154 * `EvalError` (default: `true`).
155 */
156 eval?: boolean;
157 /**
158 * If set to `false` any attempt to compile a WebAssembly module will throw a `WebAssembly.CompileError` (default: `true`).
159 */
160 wasm?: boolean;
161 /**
162 * If set to `true` any attempt to run code using async will throw a `VMError` (default: `false`).
163 * @deprecated Use `allowAsync` instead.
164 */
165 fixAsync?: boolean;
166
167 /**
168 * If set to `false` any attempt to run code using async will throw a `VMError` (default: `true`).
169 */
170 allowAsync?: boolean;
171}
172
173/**
174 * Options for creating a NodeVM

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…