Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

world_vcs.dependencies

The dependency copies under /zero/source/deps/ and what uses them. What uses a dependency is the engine's answer (install.dependencyUse): an install record that lists or pins it, a source whose reference table depends on it, and a used dependency that depends on it. Nothing here commits: a removed row leaves as a deletion in the next commit, and a changed install record is a change the next commit carries.

  • unused(ops, only?) answers the dependencies nothing in the world uses, sorted by path, held to the roots at or under only when given.
  • removeUnused(opts?, ops) removes those dependencies, or with dryRun lists them. A dependency an install placed is deleted from that install's record, and the record is taken out once it holds nothing; one the world holds as rows of its own is removed as files. It answers a RemoveUnusedReport: removed, failed and a note.
  • uninstall(path, opts?, ops) removes the install whose root is path together with the dependencies only it used. A dependency something else uses stays and is named in kept with what uses it, and the install's record then stays only to place it: the record names the install's root deleted, so world.installs() no longer lists the install, and installing the asset again puts its files back. A file this world changed or wrote itself stays as a file of the world, listed in kept_modified. It answers an UninstallReport.
  • isUninstalled(summary) answers whether an install record (one entry of install.summaries) names its own root, or a folder holding it, deleted: such a record was uninstalled and stays only to place the dependencies something else uses.
  • noticeFor(unused, lastKey?) answers the key of an unused set, whether it is a change from the last notice posted, and the notice's params.
  • watch(ops, ready) posts the NOTICE_TEMPLATE notice whenever the set of unused dependencies changes, looking again only when the engine's dependency stamp moved and ready() answers true.
  • installInto(world, opsOf) grafts world.removeUnusedDeps and world.uninstall onto the world namespace and, in the engine VM, starts the watch. world_vcs.installInto calls it once at boot.
  • canonical(path) and onlyPaths(only, fn) read a path, or the only option, in the /zero/source/... spelling.
local listed = world.removeUnusedDeps({ dryRun = true })
for _, dep in ipairs(listed.removed) do print(dep.path, dep.files) end
local report = world.uninstall("/zero/source/skate_physics.package", { dryRun = true })
print(#report.removed, "go,", #report.kept, "stay")