LYR-RES0014
an import of a package the manifest does not declare
A module imports from a package that its own package's lyric.toml does not list under [dependencies], such as a dependency of a dependency.
Explanation
A package imports what its manifest declares, and std. A package that only a dependency declares is that dependency's: it may go away or change its version without the importer having a say.
Declare the package under [dependencies] in your own lyric.toml.
Wrong
//- lyric.toml
[package]
name = "app"
version = "0.1.0"
[dependencies]
geo = { path = "deps/geo" }
//- src/main.lyr
import units.count { three };
fn main(): void {
assert(three() == 3);
}
//- deps/geo/lyric.toml
[package]
name = "geo"
version = "0.1.0"
[dependencies]
units = { path = "../units" }
//- deps/geo/src/lib.lyr
pub fn area(w: int, h: int): int {
return w * h;
}
//- deps/units/lyric.toml
[package]
name = "units"
version = "0.1.0"
//- deps/units/src/count.lyr
pub fn three(): int {
return 3;
}
Right
//- lyric.toml
[package]
name = "app"
version = "0.1.0"
[dependencies]
geo = { path = "deps/geo" }
units = { path = "deps/units" }
//- src/main.lyr
import units.count { three };
fn main(): void {
assert(three() == 3);
}
//- deps/geo/lyric.toml
[package]
name = "geo"
version = "0.1.0"
[dependencies]
units = { path = "../units" }
//- deps/geo/src/lib.lyr
pub fn area(w: int, h: int): int {
return w * h;
}
//- deps/units/lyric.toml
[package]
name = "units"
version = "0.1.0"
//- deps/units/src/count.lyr
pub fn three(): int {
return 3;
}