Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianwessel committed Jul 11, 2024
1 parent a10e498 commit 4adc3ae
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
14 changes: 3 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,10 @@
"package",
"library"
],
"files": [
"dist"
],
"files": ["dist"],
"tshy": {
"exclude": [
"src/**/*.test.ts",
"vendor"
],
"dialects": [
"esm",
"commonjs"
],
"exclude": ["src/**/*.test.ts", "vendor"],
"dialects": ["esm", "commonjs"],
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
Expand Down
32 changes: 31 additions & 1 deletion src/types/InitResponseType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,47 @@ import type { OkResponse } from './OkResponse.js'
import type { OkResponseCheck } from './OkResponseCheck.js'

export type InitResponseType = {
/**
* The QuickJS Arena runtime
*/
vm: Arena
/**
* Dispose the sandbox.
* It should not be needed to call this, as this is done automatically
*/
dispose: () => void
/**
* Execute code once and cleanup after execution.
*
* The result of the code execution must be exported with export default.
* If the code is async, it needs to be awaited on export.
*
* @example
* ```js
* const result = await evalCode('export default await asyncFunction()')
* ```
*/
evalCode: (
code: string,
filename?: string,
options?: Omit<ContextEvalOptions, 'type'> & { executionTimeout?: number },
) => Promise<OkResponse | ErrorResponse>
/**
* Compile code only, but does not execute the code.
*
* @example
* ```js
* const result = await validateCode('export default await asyncFunction()')
* ```
*/
validateCode: (
code: string,
filename?: string,
options?: Omit<ContextEvalOptions, 'type'> & { executionTimeout?: number },
) => Promise<OkResponseCheck | ErrorResponse>
mountedFs?: IFs
/**
* the virtual filesystem
*
*/
mountedFs: IFs
}

0 comments on commit 4adc3ae

Please sign in to comment.