@sebastianwessel/quickjs v2.1.1
@sebastianwessel/quickjs / RuntimeOptions
Type Alias: RuntimeOptions
RuntimeOptions:
object
Defined in: src/types/RuntimeOptions.ts:4
Type declaration
allowFetch?
optional
allowFetch:boolean
Allow code to make http(s) calls. When enabled, the global fetch will be available
allowFs?
optional
allowFs:boolean
Enable file capabilities If enabled, the package node:fs becomes available
console?
optional
console:object
Per default, the console log inside of QuickJS is passed to the host console log. Here, you can customize the handling and provide your own logging methods.
console.assert()?
optional
assert: (condition
?, ...data
) =>void
Parameters
condition?
boolean
data?
...unknown
[]
Returns
void
console.clear()?
optional
clear: () =>void
Returns
void
console.count()?
optional
count: (label
?) =>void
Parameters
label?
string
Returns
void
console.countReset()?
optional
countReset: (label
?) =>void
Parameters
label?
string
Returns
void
console.debug()?
optional
debug: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
console.dir()?
optional
dir: (item
?,options
?) =>void
Parameters
item?
unknown
options?
object
Returns
void
console.dirxml()?
optional
dirxml: (...data
) =>void
Parameters
data
...unknown
[]
Returns
void
console.error()?
optional
error: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
console.group()?
optional
group: (...label
) =>void
Parameters
label
...unknown
[]
Returns
void
console.groupCollapsed()?
optional
groupCollapsed: (...label
) =>void
Parameters
label
...unknown
[]
Returns
void
console.groupEnd()?
optional
groupEnd: () =>void
Returns
void
console.info()?
optional
info: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
console.log()?
optional
log: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
console.table()?
optional
table: (tabularData
?,properties
?) =>void
Parameters
tabularData?
unknown
properties?
string
[]
Returns
void
console.time()?
optional
time: (label
?) =>void
Parameters
label?
string
Returns
void
console.timeEnd()?
optional
timeEnd: (label
?) =>void
Parameters
label?
string
Returns
void
console.timeLog()?
optional
timeLog: (label
?, ...data
) =>void
Parameters
label?
string
data?
...unknown
[]
Returns
void
console.trace()?
optional
trace: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
console.warn()?
optional
warn: (message
?, ...optionalParams
) =>void
Parameters
message?
unknown
optionalParams?
...unknown
[]
Returns
void
dangerousSync?
optional
dangerousSync:Record
<string
,unknown
>
The object is synchronized between host and guest system. This means, the values on the host, can be set by the guest system
enableTestUtils?
optional
enableTestUtils:boolean
Includes test framework If enabled, the packages chai and mocha become available They are registered global
env?
optional
env:Record
<string
,unknown
>
Key-value list of ENV vars, which should be available in QuickJS It is not limited to primitives like string and numbers. Objects, arrays and functions can be provided as well.
Example
// in config
{
env: {
My_ENV: 'my var'
}
}
// inside of QuickJS
console.log(env.My_ENV) // outputs: my var
executionTimeout?
optional
executionTimeout:number
The maximum time in seconds a script can run. Unset or set to 0 for unlimited execution time.
fetchAdapter?
optional
fetchAdapter: typeoffetch
The custom fetch adapter provided as host function in the QuickJS runtime
mountFs?
optional
mountFs:NestedDirectoryJSON
|IFs
Mount a virtual file system
Link
https://github.com/streamich/memfs
nodeModules?
optional
nodeModules:NestedDirectoryJSON
Mount custom node_modules in a virtual file system
Link
https://github.com/streamich/memfs
transformCompilerOptions?
optional
transformCompilerOptions:TS.CompilerOptions
The Typescript compiler options for transpiling files from typescript to JavaScript
transformTypescript?
optional
transformTypescript:boolean
Transpile all typescript files to javascript file in mountFs Requires dependency typescript to be installed