(context: QuickJSContext, source: string, filename: string)
| 85 | /** Evaluate one chunk, converting QuickJS's error handle into a thrown Error |
| 86 | * whose message is the sandbox's own. */ |
| 87 | const evaluate = (context: QuickJSContext, source: string, filename: string): void => { |
| 88 | const result = context.evalCode(source, filename); |
| 89 | if (result.error) { |
| 90 | const dumped: unknown = context.dump(result.error); |
| 91 | result.error.dispose(); |
| 92 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: QuickJS reports failure as a handle; this is where it becomes a JS error |
| 93 | throw new Error( |
| 94 | typeof dumped === "object" && dumped !== null && "message" in dumped |
| 95 | ? String((dumped as { message: unknown }).message) |
| 96 | : String(dumped), |
| 97 | ); |
| 98 | } |
| 99 | result.value.dispose(); |
| 100 | }; |
| 101 | |
| 102 | const runSealedBundle = async ( |
| 103 | options: SealedBundleOptions, |
no test coverage detected