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: f5063d6fa53bf8be818f4316273ee81fb5474d21When an import path starts with the lock entry name, Nubo maps it to the cached package path.
Importing a Package
Section titled “Importing a Package”After installing:
nubo get github.com/nubolang/colorImport 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.
How Mapping Works
Section titled “How Mapping Works”If the import path starts with:
nubolang/colorand the lock entry points to:
github.com/nubolang/color@f5063d6...Nubo maps the import to:
~/nubo/packages/github.com/nubolang/color@f5063d6.../<remaining-path>Importing the Root Package
Section titled “Importing the Root Package”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.
Importing a File or Subpath
Section titled “Importing a File or Subpath”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>/themeSubpath Packages
Section titled “Subpath Packages”If you add a subpath package:
nubo get github.com/org/repo/pkg/toolsthe package name can become:
org/repo/pkg/toolsThen import it with that name:
import tools from "org/repo/pkg/tools"Prefix Matching
Section titled “Prefix Matching”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.
Local Paths Still Work
Section titled “Local Paths Still Work”If no package lock entry matches the import path, Nubo leaves the path unchanged.
That allows normal local imports to keep working.