sourceBindings.module
This package holds more than this page lists. See all of its files in its world.
README.md
Source bindings
Captures editable inputs supplied by builders, remaps their generated output ids to persistent scene ids, and retains exact source revisions for later checked edits.
local Bindings = require("@builtin::modules.sourceBindings")
local inputs, result = Bindings.capture(function()
Bindings.attach(target) -- target from SourceEditing.bind
return "built"
end)
local registry = Bindings.pack({{owner="build",targets=inputs,placements={captured="persistent"}}})
local available = Bindings.list(registry, "persistent")
local reopened = Bindings.resolve(registry, "build", available[1].id)
Inside a scene build, build.source() returns the exact build.luau snapshot being evaluated, including proposed source during candidate preparation. Use it with SourceEditing.calls to locate editable arguments, then call build.bindSource(target) after creating the entities named by the target. The scene captures these registrations, maps their outputs to persistent placements, and saves the registry in authoring/state.json under build.bindings. Source files discovered through bindings join the transaction read set; a changed original input or edit record refuses the build. A tool can reopen that saved registry with Bindings.resolve to prepare a checked source replacement.
The registry deduplicates source versions by asset guid and stores their exact-byte SHA-256 revisions. Resolving an input follows its asset identity to its current path and refuses changed bytes. Repeated registrations of one owner/input id combine known outputs only when their source occurrence and scope agree. Every output must occur in the supplied placement map. Scope completeness remains explicit. Nested capture scopes keep their registrations separate and restore the outer scope after an error.