Skip to content

Import Resolution

Nubo resolves package imports using lock.yaml.

A lock entry looks like this:

- name: nubolang/color
source: https://github.com/nubolang/color.git
commit_hash: f5063d6fa53bf8be818f4316273ee81fb5474d21

When an import path starts with the lock entry name, Nubo maps it to the cached package path.

After installing:

Terminal window
nubo get github.com/nubolang/color

Import the package by its lock name:

import color from "@nubolang/color"

Not by the full GitHub URL.

// Usually wrong for package resolution:
import color from "github.com/nubolang/color"

The remote source includes the domain, but the package name does not.

If the import path starts with:

nubolang/color

and the lock entry points to:

github.com/nubolang/color@f5063d6...

Nubo maps the import to:

~/nubo/packages/github.com/nubolang/color@f5063d6.../<remaining-path>

For:

import color from "@nubolang/color"

Nubo maps the import to the package root.

If the import path exactly matches the package name, Nubo uses the repository name as the remaining path internally.

You can import a subpath from the package.

import theme from "@nubolang/color/theme"

This maps into the cached package under the remaining path:

~/nubo/packages/github.com/nubolang/color@<commit>/theme

If you add a subpath package:

Terminal window
nubo get github.com/org/repo/pkg/tools

the package name can become:

org/repo/pkg/tools

Then import it with that name:

import tools from "org/repo/pkg/tools"

Nubo checks package lock entries and finds the first one where the import path starts with the package name.

Because of this, package names should be specific enough to avoid accidental overlaps.

If no package lock entry matches the import path, Nubo leaves the path unchanged.

That allows normal local imports to keep working.