Modules

import🔗

Functions must be explicitly imported before use. Types are always in scope.

import { println, push } from "dogma:core"
import { read_file } from "dogma:fs"

Import multiple items in one statement. The package name follows from.

Package structure🔗

A Dogma package has a dogma.toml manifest:

[package]
name = "my-package"
version = "0.1.0"

[dependencies]
dogma:core = "*"

Add dependencies with the CLI:

dogma add dogma:core
dogma add some-package --version "^1.0"

Install all dependencies:

dogma install

Virtual packages vs registry packages🔗

Virtual packages (dogma:core, dogma:fs, dogma:net, dogma:process, dogma:collections, dogma:async) are built into the runtime. They are always available without a registry download. The host controls which virtual packages a script may use — see the Embedding Guide.

Registry packages are downloaded from registry.dogma.ws and cached locally. They are plain Dogma source files published by other authors.

Multi-file packages🔗

A package can span multiple .dg source files. Each file is a module. Import from sibling files using a relative path:

import { helper } from "./utils"