Перейти к содержимому
Топаз6.0 · До релиза
Загрузка →

Поиск в документации

Спецификация 6.0

Выберите результат стрелками и нажмите Enter, чтобы открыть его.

Введите имя API, номер диагностики, правило или тему проекта.

    Инструменты

    Пакеты, файлы фиксации и цели

    Describe a package in topaz.toml, bind its inputs in topaz.lock, and select the artifact that build produces.

    Package root and entry

    Ссылка

    A package root contains topaz.toml. Package-mode commands load that file from the selected root, which defaults to the current directory. The manifest is read before the package entry source.

    Package loading source

    [package] declares the package name, version, language mode, and entry path. The entry is relative to the package root. License metadata is optional. Unknown top-level sections and unknown fields in supported sections are rejected.

    Manifest sections source · Package fields source

    topaz init --root app creates a native package with a complete entry program. It refuses to overwrite an existing manifest or entry. Use that scaffold as the starting point for the configuration below.

    Scaffold source

    Configuration example

    Ссылка

    Complete native package configuration

    Ссылка
    topaz.tomlComplete native package configurationОткрыть песочницу →
    1. [package]
    2. name = "reference_app"
    3. version = "0.1.0"
    4. language = "5.21"
    5. entry = "src/main.tpz"
    6. [build]
    7. target = "native"
    8. deterministic = true
    9. [dependencies]
    10. std = { version = "5.21" }
    src/main.tpzComplete native package configurationОткрыть песочницу →
    1. import std.io
    2. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    3. io.writeLine("Hello from Topaz")
    4. Ok(0)
    5. }
    Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Configuration example. The command references own executable check, initialization, and lock examples.

    Place both files under the same package root. Run package-mode commands from that root, or select it with --root.

    Dependency identity

    Ссылка

    Each dependency declaration uses a table. A version dependency has version and may have hash. A path dependency has path and requires hash. The table chooses exactly one of version and path. A bare version string is rejected when the package manifest is loaded.

    Dependency declaration source

    Registry dependency compilation requires --locked and matching content under vendor/<name>/<version>. The dependency package name and version must agree with the declaration. A local dependency's manifest name must also agree with its declared name.

    Package dependency loading source

    [exports].module selects the module a dependency exposes as its root. Without that section, its package entry supplies the root. A dependency name that collides with a root module path is rejected. These configuration relationships do not redefine source import syntax.

    What topaz.lock binds

    Ссылка

    topaz.lock records the root package identity and a manifest_hash derived from the manifest text. It also binds declared dependency identities and content hashes. Changing a locked input requires a corresponding lock update.

    Lock verification source · Manifest digest source

    --locked verifies the existing lock before the applicable package operation continues. Missing, stale, duplicate, or undeclared lock entries are rejected. topaz lock writes the lock for the current manifest. It does not waive a mismatched local dependency hash.

    Lock verification also checks declared extern artifacts and replay inputs, plus embedded Lispex source, limits, quotas, and prepared artifacts when present. A matching root manifest hash does not replace those checks.

    Select the build artifact

    Ссылка

    [build].target selects native, web, or web-worker. An omitted build target selects native. Ordinary package loading requires deterministic builds. The separate usage-profile validation path does not enable an unrestricted nondeterministic build.

    Build configuration source

    For package builds, an explicit command target takes precedence over the manifest target. Without a command target, build uses the manifest. Entry-file builds use their command target or the native default. Web targets cannot be combined with automatic execution through --run.

    Package build selection source

    The target describes the resulting artifact. It does not select SELF or the reference compiler. emit has a separate Rust-source target and does not produce a final native or web binary.

    Embedded Lispex configuration

    Ссылка

    [lispex] selects a package-owned evaluator profile and declares at least one [[lispex.rule]]. Each rule has a unique name and distinct project-relative source and limits paths. A package containing this section requires locked compilation.

    Lispex configuration source · Locked package requirement

    An application identifier and its application_quotas file appear together. The application and evaluator profile must be a supported pair. In the current language mode, application configuration also requires the exact standard-library version for that mode.

    Application binding source

    The Lispex admission contract defines package admission and component identities. The factory contract defines generated calls from the verified lock. Installed profile availability requires distribution evidence.

    Lispex lock verification follows the package admission and generated factory contracts. Changing a locked input requires a matching lock update.

    Additional package inputs

    Ссылка

    [capabilities.fs] declares project-relative read and write roots. [extern] declares externally implemented modules and their associated inputs. An extern module cannot occupy a root path already used by a local module or dependency.

    Capability and export declarations · Extern module collision source

    The complete external ABI and host sandbox behavior belong to their own reference contracts. This page records their effect on package identity and lock verification.

    Pending contracts

    Ссылка

    One registry materialization command

    Ссылка
    Правилоtopaz.tools.registry-command.rule

    One registry materialization command

    Use topaz vendor --from <registry> for registry dependency materialization. topaz fetch is rejected during command validation.

    The vendor command without --from checks existing vendored content and updates the lock. Supplying --from also copies the selected registry content.

    Причина

    Both reviewed command names materialize the same dependencies in the vendor directory and write the same lock. They express the same dependency materialization intent. The vendor name identifies the destination.

    One registry materialization command rejection

    Семейство
    topaz-cli
    Этап
    command
    Операция
    argument-validation
    Категория
    registry-command

    Причина и условия

    Use topaz vendor --from <registry> for registry dependency materialization. topaz fetch is rejected during command validation.

    Действия

    Use topaz vendor --from <registry> to materialize registry dependencies.

    One registry materialization command examples

    Ссылка

    Reject the fetch command alias

    Ссылка
    main.tpzReject the fetch command aliasОткрыть песочницу →
    1. let value = 1
    Ожидаемый выводКод завершения 1
    Нет стандартного вывода.
    $ topaz fetch --root . --from registry · Целевой продукт 5.21.3
    topaz.tomlReject the fetch command aliasОткрыть песочницу →
    1. [package]
    2. name = "tools_registry_example"
    3. version = "0.1.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    6. [build]
    7. target = "native"
    8. deterministic = true
    9. [dependencies]
    10. sample = { version = "1.0.0" }
    registry/sample/1.0.0/topaz.tomlReject the fetch command aliasОткрыть песочницу →
    1. [package]
    2. name = "sample"
    3. version = "1.0.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    registry/sample/1.0.0/main.tpzReject the fetch command aliasОткрыть песочницу →
    1. export let value = 1
    Ожидаемый результат

    Ожидаемый результат

    Этап отклонения command. Код завершения 1.

    Materialize a registry dependency with vendor

    Ссылка
    main.tpzMaterialize a registry dependency with vendorОткрыть песочницу →
    1. let value = 1
    Ожидаемый выводКод завершения 0
    Нет стандартного вывода.
    $ topaz vendor --root . --from registry · Целевой продукт 5.21.3
    topaz.tomlMaterialize a registry dependency with vendorОткрыть песочницу →
    1. [package]
    2. name = "tools_registry_example"
    3. version = "0.1.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    6. [build]
    7. target = "native"
    8. deterministic = true
    9. [dependencies]
    10. sample = { version = "1.0.0" }
    registry/sample/1.0.0/topaz.tomlMaterialize a registry dependency with vendorОткрыть песочницу →
    1. [package]
    2. name = "sample"
    3. version = "1.0.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    registry/sample/1.0.0/main.tpzMaterialize a registry dependency with vendorОткрыть песочницу →
    1. export let value = 1
    Ожидаемый результат

    Ожидаемый результат

    Проверка принимает программу. Код завершения 0.

    Dependency declarations use tables

    Ссылка
    Правилоtopaz.tools.dependency-table.rule

    Dependency declarations use tables

    Each entry in [dependencies] is a table. A bare version string is rejected while the package manifest is loaded.

    A version dependency uses version and may include hash. A path dependency uses path and requires hash. Each table chooses exactly one of version and path.

    Причина

    A version string and a table containing that version select the same dependency. The table preserves this intent and carries version, path, and content hash fields through one declaration structure.

    Dependency declarations use tables rejection

    Семейство
    topaz-cli
    Этап
    package
    Операция
    manifest-admission
    Категория
    dependency-table

    Причина и условия

    Each entry in [dependencies] is a table. A bare version string is rejected while the package manifest is loaded.

    Действия

    Use a table such as std = { version = "5.21" } in [dependencies].

    Dependency declarations use tables examples

    Ссылка

    Reject a version string dependency

    Ссылка
    topaz.tomlReject a version string dependencyОткрыть песочницу →
    1. [package]
    2. name = "tools_dependency_table"
    3. version = "0.1.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    6. [dependencies]
    7. std = "5.21"
    main.tpzReject a version string dependencyОткрыть песочницу →
    1. let value = 1
    Ожидаемый выводКод завершения 1
    Нет стандартного вывода.
    $ topaz lock --root . · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Этап отклонения package. Код завершения 1.

    Lock a table dependency

    Ссылка
    topaz.tomlLock a table dependencyОткрыть песочницу →
    1. [package]
    2. name = "tools_dependency_table"
    3. version = "0.1.0"
    4. language = "5.21"
    5. entry = "main.tpz"
    6. [dependencies]
    7. std = { version = "5.21" }
    main.tpzLock a table dependencyОткрыть песочницу →
    1. let value = 1
    Ожидаемый выводКод завершения 0
    Нет стандартного вывода.
    $ topaz lock --root . · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Проверка принимает программу. Код завершения 0.

    Related commands and selection

    Ссылка

    Compiler selection →

    init →

    lock →

    build →

    check →

    Меню

    Загрузка →