You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the past this didn't cause any issues for me since Deno.core.evalContext() provided an equivalent API.
Sadly this API was dropped in deno version 1.30.
const _tmp_err = Deno.core.evalContext(code)[1]; if (_tmp_err !== null) throw _tmp_err.thrown;
The behavior of the function should be implemented using Deno.core.evalContext().
Steps to Reproduce
Start deno
import * as vm from "node:vm";
vm.runInThisContext("let p = 12"); console.log(p)
Expected behavior
12 should be printed to the console.
Environment
OS: Archlinux
deno version: 1.30
std version: 0.174.0
The text was updated successfully, but these errors were encountered:
Describe the bug
The node:vm.runInThisContext() function doesn't behave correctly on deno.
Node:
vm.runInThisContext("let p = 12"); console.log(p)
12
Deno:
vm.runInThisContext("let p = 12"); console.log(p)
Uncaught ReferenceError: p is not defined
at :3:13
On deno this function is implemented as
return eval.call(globalThis, this.code);
(https://github.com/denoland/deno_std/blob/main/node/vm.ts#L14).It is not possible with eval to define local variables (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval).
In the past this didn't cause any issues for me since
Deno.core.evalContext()
provided an equivalent API.Sadly this API was dropped in deno version 1.30.
const _tmp_err = Deno.core.evalContext(code)[1]; if (_tmp_err !== null) throw _tmp_err.thrown;
The behavior of the function should be implemented using
Deno.core.evalContext()
.Steps to Reproduce
Start deno
Expected behavior
12
should be printed to the console.Environment
The text was updated successfully, but these errors were encountered: