Skip to content
VaelJS Blog

Globals (Vael & console)

Both vjs (V8) and vjs-lite (QuickJS) install only two ambient globals — Vael and console — with no browser or legacy host globals.

globalThis.Vael & globalThis.console
Since v0.0.0-alpha.0 vjs (V8) vjs-lite (QuickJS)
Profiles: Generated from v8/globals.d.ts and lite/globals.d.ts
constSince v0.0.0-alpha.0vjs & vjs-lite
declare const console: VaelConsole;

Global console output object installed by vjs (vaeljs, V8).

constSince v0.0.0-alpha.0vjs & vjs-lite
declare const Vael: VaelGlobal;

Frozen VaelJS runtime introspection object (engine: "vael").

interfaceSince v0.0.0-alpha.0vjs & vjs-lite
interface VaelConsole {
  log(...args: unknown[]): void;
  debug(...args: unknown[]): void;
  info(...args: unknown[]): void;
  warn(...args: unknown[]): void;
  error(...args: unknown[]): void;
}

Standard console output methods installed on globalThis.console in the vjs (vaeljs, V8) runtime.

log, debug, and info write to stdout; warn and error write to stderr. Strings print unchanged, typed arrays print their type and up to ten elements, and objects are formatted as indented JSON when serializable.

Methods
methodSince v0.0.0-alpha.0
log(...args: unknown[]): void;

Write formatted arguments separated by spaces to stdout, followed by a newline.

Parameters
NameTypeDescription
...argsunknown[]Values to format and write to stdout.
Returns
void
console.log("hello", { ok: true });
methodSince v0.0.0-alpha.0
debug(...args: unknown[]): void;

Write formatted debug arguments separated by spaces to stdout, followed by a newline.

Parameters
NameTypeDescription
...argsunknown[]Values to format and write to stdout.
Returns
void
methodSince v0.0.0-alpha.0
info(...args: unknown[]): void;

Write formatted informational arguments separated by spaces to stdout, followed by a newline.

Parameters
NameTypeDescription
...argsunknown[]Values to format and write to stdout.
Returns
void
methodSince v0.0.0-alpha.0
warn(...args: unknown[]): void;

Write formatted warning arguments separated by spaces to stderr, followed by a newline.

Parameters
NameTypeDescription
...argsunknown[]Values to format and write to stderr.
Returns
void
methodSince v0.0.0-alpha.0
error(...args: unknown[]): void;

Write formatted error arguments separated by spaces to stderr, followed by a newline.

Parameters
NameTypeDescription
...argsunknown[]Values to format and write to stderr.
Returns
void
console.error("operation failed:", new Error("timeout"));
interfaceSince v0.0.0-alpha.0vjs & vjs-lite
interface VaelBuiltInModuleMap {
  "vael:age": typeof import("vael:age");
  "vael:amqp": typeof import("vael:amqp");
  "vael:ansi": typeof import("vael:ansi");
  "vael:archive": typeof import("vael:archive");
  "vael:assert": typeof import("vael:assert")["default"];
  "vael:chars": typeof import("vael:chars");
  "vael:console": typeof import("vael:console")["default"];
  "vael:cron": typeof import("vael:cron");
  "vael:crypto": typeof import("vael:crypto");
  "vael:db": typeof import("vael:db");
  "vael:db/migrate": typeof import("vael:db/migrate");
  "vael:exec": typeof import("vael:exec");
  "vael:fetch": typeof import("vael:fetch");
  "vael:fmt": typeof import("vael:fmt");
  "vael:fmt/bytes": typeof import("vael:fmt/bytes");
  "vael:fmt/duration": typeof import("vael:fmt/duration");
  "vael:fmt/inspect": typeof import("vael:fmt/inspect");
  "vael:fmt/printf": typeof import("vael:fmt/printf");
  "vael:fmt/strip-ansi-code": typeof import("vael:fmt/strip-ansi-code");
  "vael:fs": typeof import("vael:fs");
  "vael:fs/acl": typeof import("vael:fs/acl");
  "vael:http": typeof import("vael:http");
  "vael:nats": typeof import("vael:nats");
  "vael:os": typeof import("vael:os");
  "vael:os/dirs": typeof import("vael:os/dirs");
  "vael:path": typeof import("vael:path");
  "vael:redis": typeof import("vael:redis");
  "vael:slices": typeof import("vael:slices");
  "vael:ssh": typeof import("vael:ssh");
  "vael:stdio": typeof import("vael:stdio");
  "vael:strings": typeof import("vael:strings");
  "vael:template": Omit<typeof import("vael:template"), "default">;
  "vael:test": Omit<typeof import("vael:test"), "default">;
  "vael:uuid": typeof import("vael:uuid");
  "vael:uuid/v4": typeof import("vael:uuid/v4");
  "vael:uuid/v7": typeof import("vael:uuid/v7");
}

Mapping from canonical vael:* built-in module specifiers available in the vjs (vaeljs, V8) profile to the object returned by Vael.getBuiltInModule.

SpecifierReturned Value TypeAvailability
vael:agetypeof import("vael:age")vjs only
vael:amqptypeof import("vael:amqp")vjs only
vael:ansitypeof import("vael:ansi")vjs & vjs-lite
vael:archivetypeof import("vael:archive")vjs & vjs-lite
vael:asserttypeof import("vael:assert")["default"]vjs & vjs-lite
vael:charstypeof import("vael:chars")vjs & vjs-lite
vael:consoletypeof import("vael:console")["default"]vjs & vjs-lite
vael:crontypeof import("vael:cron")vjs only
vael:cryptotypeof import("vael:crypto")vjs & vjs-lite
vael:dbtypeof import("vael:db")vjs only
vael:db/migratetypeof import("vael:db/migrate")vjs only
vael:exectypeof import("vael:exec")vjs & vjs-lite
vael:fetchtypeof import("vael:fetch")vjs & vjs-lite
vael:fmttypeof import("vael:fmt")vjs & vjs-lite
vael:fmt/bytestypeof import("vael:fmt/bytes")vjs & vjs-lite
vael:fmt/durationtypeof import("vael:fmt/duration")vjs & vjs-lite
vael:fmt/inspecttypeof import("vael:fmt/inspect")vjs & vjs-lite
vael:fmt/printftypeof import("vael:fmt/printf")vjs & vjs-lite
vael:fmt/strip-ansi-codetypeof import("vael:fmt/strip-ansi-code")vjs & vjs-lite
vael:fstypeof import("vael:fs")vjs & vjs-lite
vael:fs/acltypeof import("vael:fs/acl")vjs & vjs-lite
vael:httptypeof import("vael:http")vjs only
vael:natstypeof import("vael:nats")vjs only
vael:ostypeof import("vael:os")vjs & vjs-lite
vael:os/dirstypeof import("vael:os/dirs")vjs & vjs-lite
vael:pathtypeof import("vael:path")vjs & vjs-lite
vael:redistypeof import("vael:redis")vjs only
vael:slicestypeof import("vael:slices")vjs & vjs-lite
vael:sshtypeof import("vael:ssh")vjs & vjs-lite
vael:stdiotypeof import("vael:stdio")vjs only
vael:stringstypeof import("vael:strings")vjs & vjs-lite
vael:templateOmit<typeof import("vael:template"), "default">vjs & vjs-lite
vael:testOmit<typeof import("vael:test"), "default">vjs & vjs-lite
vael:uuidtypeof import("vael:uuid")vjs & vjs-lite
vael:uuid/v4typeof import("vael:uuid/v4")vjs & vjs-lite
vael:uuid/v7typeof import("vael:uuid/v7")vjs & vjs-lite
interfaceSince v0.0.0-alpha.0vjs & vjs-lite
interface VaelGlobal {
  readonly engine: "vael";
  getBuiltInModule<K extends keyof VaelBuiltInModuleMap>(specifier: K): VaelBuiltInModuleMap[K];
  getBuiltInModule(specifier: string): unknown;
  getBuiltInModulesList(): readonly string[];
}

Frozen introspection global installed on globalThis.Vael in the vjs (vaeljs, V8) runtime.

Properties
PropertyTypeDescriptionSince
engine readonly"vael"Active runtime engine identifier ("vael" for V8).v0.0.0-alpha.0
Methods
methodSince v0.0.0-alpha.0
getBuiltInModule<K extends keyof VaelBuiltInModuleMap>(specifier: K): VaelBuiltInModuleMap[K];
getBuiltInModule(specifier: string): unknown;

Return the cached built-in module object for a canonical vael:* specifier, or undefined when the specifier is not registered.

Parameters
NameTypeDescription
specifierK | stringCanonical vael:* built-in module specifier; Module specifier string to look up.
Returns
  • VaelBuiltInModuleMap[K] — The cached built-in module object for specifier.
  • unknown — The cached built-in module object, or undefined if unknown.
Exceptions
  • TypeError — when specifier is not a string.
const os = Vael.getBuiltInModule("vael:os");
console.log(os.platform);
methodSince v0.0.0-alpha.0
getBuiltInModulesList(): readonly string[];

Return the frozen array of canonical vael:* specifiers enabled in this runtime, in registration order.

Returns
readonly string[] — Frozen array of registered vael:* module specifiers.
const modules = Vael.getBuiltInModulesList();
console.log(modules.includes("vael:fs"));