Skip to content

deno

stable

Embeds a Deno JavaScript/TypeScript runtime into Zolo programs, enabling inline JS/TS evaluation, module execution, and subprocess management via the Deno CLI.

use plugin deno::{Deno.new, Deno.eval, Deno.eval_module, …}
18 functions Web
/ filter jk navigate Esc clear
Functions (18)
  1. Deno.new Creates a new Deno runtime instance.
  2. Deno.eval Evaluates a JavaScript/TypeScript expression string in the REPL session and returns the result as a Zolo value.
  3. Deno.eval_module Evaluates a block of TypeScript/JavaScript as an ES module (supports import/export syntax and top-level await).
  4. Deno.eval_file Evaluates a TypeScript/JavaScript file at the given path using import().
  5. Deno.set_global Sets a global variable in the Deno runtime that subsequent eval calls can access.
  6. Deno.call_function Calls a named JavaScript function already defined in the Deno runtime, passing Zolo values as arguments.
  7. Deno.close Shuts down the Deno REPL session and releases the handle.
  8. Deno.spawn Static method.
  9. Deno.run Static method.
  10. DenoProcess.status Returns "running" or "exited" for the subprocess.
  11. DenoProcess.wait Blocks until the subprocess exits and returns its exit code.
  12. DenoProcess.kill Kills the subprocess immediately.
  13. DenoProcess.output Returns all captured stdout output from the subprocess as a string.
  14. DenoProcess.errors Returns all captured stderr output from the subprocess as a string.
  15. DenoProcess.write Writes a string to the subprocess's stdin.
  16. DenoProcess.close_stdin Closes the subprocess's stdin pipe, signaling end-of-input.
  17. DenoProcess.pid Returns the OS process ID of the subprocess.
  18. DenoProcess.exit_code Returns the exit code if the process has exited, or nil if still running.

Creates a new Deno runtime instance.

Creates a new Deno runtime instance. The optional config table accepts:

  • mode: "auto" (default), "process", or "embedded"
  • deno_path: custom path to the deno binary
  • allow_net, allow_read, allow_write, allow_env: permission flags
use plugin deno::{Deno}

let d = Deno.new()
let result = d.eval("1 + 2")
print(result)  // 3
d.close()

Evaluates a JavaScript/TypeScript expression string in the REPL session and returns the result as a Zolo value.

Evaluates a JavaScript/TypeScript expression string in the REPL session and returns the result as a Zolo value.

use plugin deno::{Deno}

let d = Deno.new()
d.set_global("name", "World")
let msg = d.eval("`Hello, ${name}!`")
print(msg)  // "Hello, World!"
d.close()

Evaluates a block of TypeScript/JavaScript as an ES module (supports import/export syntax and top-level await).

Evaluates a block of TypeScript/JavaScript as an ES module (supports import/export syntax and top-level await).

use plugin deno::{Deno}

let d = Deno.new()
let val = d.eval_module("
  const arr = [1, 2, 3];
  arr.reduce((a, b) => a + b, 0)
")
print(val)  // 6
d.close()

Evaluates a TypeScript/JavaScript file at the given path using import().

Evaluates a TypeScript/JavaScript file at the given path using import().

use plugin deno::{Deno}

let d = Deno.new(#{"allow_read": true})
let result = d.eval_file("./scripts/compute.ts")
print(result)
d.close()

Sets a global variable in the Deno runtime that subsequent eval calls can access.

Sets a global variable in the Deno runtime that subsequent eval calls can access. Supported value types: nil, bool, integer, number, string.

use plugin deno::{Deno}

let d = Deno.new()
d.set_global("threshold", 42)
let check = d.eval("threshold > 10")
print(check)  // true
d.close()

Calls a named JavaScript function already defined in the Deno runtime, passing Zolo values as arguments.

Calls a named JavaScript function already defined in the Deno runtime, passing Zolo values as arguments.

use plugin deno::{Deno}

let d = Deno.new()
d.eval_module("function double(x) { return x * 2; }")
let result = d.call_function("double", 21)
print(result)  // 42
d.close()

Shuts down the Deno REPL session and releases the handle.

Shuts down the Deno REPL session and releases the handle.

Static method.

Static method. Spawns a Deno script file as an independent subprocess and returns a DenoProcess handle. The optional config table accepts permission flags, args, cwd, on_stdout, on_stderr, and deno_path.

use plugin deno::{Deno}

let proc = Deno.spawn("./server.ts", #{"allow_net": true})
let code = proc.wait()
print("exit code: {code}")

Static method.

Static method. Writes inline TypeScript/JavaScript to a temporary file and runs it as a subprocess. Returns a DenoProcess handle.

use plugin deno::{Deno}

let proc = Deno.run("
  for (let i = 0; i < 3; i++) {
    console.log('line ' + i);
  }
")
let code = proc.wait()
print(proc.output())

Returns "running" or "exited" for the subprocess.

Returns "running" or "exited" for the subprocess.

Blocks until the subprocess exits and returns its exit code.

Blocks until the subprocess exits and returns its exit code.

Kills the subprocess immediately.

Kills the subprocess immediately.

Returns all captured stdout output from the subprocess as a string.

Returns all captured stdout output from the subprocess as a string.

Returns all captured stderr output from the subprocess as a string.

Returns all captured stderr output from the subprocess as a string.

Writes a string to the subprocess's stdin.

Writes a string to the subprocess's stdin.

Closes the subprocess's stdin pipe, signaling end-of-input.

Closes the subprocess's stdin pipe, signaling end-of-input.

Returns the OS process ID of the subprocess.

Returns the OS process ID of the subprocess.

Returns the exit code if the process has exited, or nil if still running.

Returns the exit code if the process has exited, or nil if still running.

enespt-br