| 81 | * Require options for a VM |
| 82 | */ |
| 83 | export interface VMRequire { |
| 84 | /** |
| 85 | * Array of allowed built-in modules, accepts ["*"] for all. Using "*" increases the attack surface and potential |
| 86 | * new modules allow to escape the sandbox. (default: none) |
| 87 | */ |
| 88 | builtin?: readonly string[]; |
| 89 | /* |
| 90 | * `host` (default) to require modules in host and proxy them to sandbox. `sandbox` to load, compile and |
| 91 | * require modules in sandbox or a callback which chooses the context based on the filename. |
| 92 | * Built-in modules except `events` always required in host and proxied to sandbox |
| 93 | */ |
| 94 | context?: "host" | "sandbox" | PathContextCallback; |
| 95 | /** `true`, an array of allowed external modules or an object with external options (default: `false`) */ |
| 96 | external?: boolean | readonly string[] | { modules: readonly string[], transitive: boolean }; |
| 97 | /** Array of modules to be loaded into NodeVM on start. */ |
| 98 | import?: readonly string[]; |
| 99 | /** Restricted path(s) where local modules can be required (default: every path). */ |
| 100 | root?: string | readonly string[]; |
| 101 | /** Collection of mock modules (both external or built-in). */ |
| 102 | mock?: any; |
| 103 | /* An additional lookup function in case a module wasn't found in one of the traditional node lookup paths. */ |
| 104 | resolve?: (moduleName: string, parentDirname: string) => string | { path: string, module?: string } | undefined; |
| 105 | /** Custom require to require host and built-in modules. */ |
| 106 | customRequire?: HostRequire; |
| 107 | /** Load modules in strict mode. (default: true) */ |
| 108 | strict?: boolean; |
| 109 | /** FileSystem to load files from */ |
| 110 | fs?: VMFileSystemInterface; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * A custom compiler function for all of the JS that comes |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…