src/pkg/pkg.bend checks
raw source on the hub · import ezx@1.7.0.0/src/pkg/pkg.bend as Pkg
pkg/pkg: the package a bend <entry> --publish would upload, computed
without publishing: the file set, their sha256s, and the 0x<hash> that names
them. This mirrors pkg_files and the hash in bend's cli_publish.
tests/publish.sh pins it against the real thing by running bend --publish
at a local hub, so drift fails the gate rather than the ecosystem.
The walk is pure: of computes the package from a checkout's files alone,
which is what ez add in planner form will run, and pkg_of and pkg_in
run the same walk given nothing, answering each file it asks for from disk.
Bend refuses an import cycle, and this module both defines the file list the
walk hashes and runs it, so the walk lives here rather than in a module of
its own.
4 imports
import Base import ../io/file.bend as F import ../share/sha.bend as Sha import ./path.bend as P
Types
type Item source · line 19 · raw
Data
a file of a package: the path it takes inside the package, and its sha256
Item@at:String -> @sum:String -> Item
type Pkg source · line 27 · raw
Data
a package: the files it holds, the hash that names them, and the directory
their paths are written from. The root is the entry's own directory until a
module reached through .. re-roots the package above it, so a caller
copying the files out joins them against this and never against the entry's
directory.
Pkg@hash:String -> @root:String -> @files:List<&2, Item> -> Pkg
type Scan source · line 32 · raw
Data
what a source file's header imports: modules by the path they were reached through, and the foreign C and JS bodies bend uploads alongside the sources
Scan@mods:List<&2, String> -> @foreign:List<&2, String> -> Scan
type Stmt source · line 36 · raw
Data
what one line of a source file turned out to be
SNoneStmt
SMod@spec:String -> Stmt
SForeign@at:String -> Stmt
SBodyStmt
type Head source · line 43 · raw
Data
a scan in progress: head is true while the imports still head the file
Head@head:Bool -> @mods:List<&2, String> -> @foreign:List<&2, String> -> Head
type Cut source · line 116 · raw
Data
the fields of a line read so far: the field under way, and the fields after it
Cut@field:String -> @after:List<&2, String> -> Cut
type Task source · line 451 · raw
Data
a file to visit: where it is on disk, and the module name bend gives it,
which is the path it was reached through with the .bend dropped
Task@file:String -> @ns:String -> Task
type Found source · line 456 · raw
Data
a file of the package as it was found: where it sits inside the package, and its sha256
Found@raw:String -> @sum:String -> Found
type Source source · line 678 · raw
Data
one file of a checkout: its path from the checkout's top, and its text
Source@at:String -> @text:String -> Source
type Tree source · line 685 · raw
Data
the files a walk is given. A whole tree is every file of a checkout, so a path it does not hold is not there. A partial one is what has been read so far, with the paths that were asked for and found missing; any other path is one the walk was not given, and it asks for it.
Tree@whole:Bool -> @files:List<&2, Source> -> @gone:List<&2, String> -> Tree
type Look source · line 689 · raw
Data
what a tree says of a path: here with its text, not there, or not given
Here@text:String -> Look
AbsentLook
UnaskedLook
type Hit source · line 696 · raw
Data
a file of the package as the walk found it: the name it takes inside the package, and its text
Hit@raw:String -> @text:String -> Hit
type Stop source · line 703 · raw
Data
why the walk stopped, or that it has not: a module imported and not there, an import that climbs out of the checkout, a file the walk was not given, fuel run out with files still queued, or an import of a name the hub rules out
GoingStop
Missing@at:String -> Stop
Climbs@at:String -> Stop
Asking@at:String -> Stop
SpentStop
Unnamed@nv:String -> Stop
type State source · line 713 · raw
Data
the walk so far: the files already visited, what was found, whether it has stopped, and the files still to visit
State@seen:List<&2, String> -> @out:List<&2, Hit> -> @stop:Stop -> @queue:List<&2, Task> -> State
type Walked source · line 720 · raw
Data
what the walk made of a tree: the package, the file it needs next, or why there is no package. A package is its hash, the directory its paths are written from, the files it lays with their texts, and those files weighed, in path order, which is what its manifest lists.
Walked@hash:String -> @root:String -> @files:List<&2, Source> -> @sums:List<&2, Item> -> Walked
Asks@at:String -> Walked
Refused@why:String -> Walked
Definitions
def words.keep source · line 47 · raw
@ws:List<&2, String> -> List<&2, String>
the words of a line, with the runs of spaces dropped
def words source · line 56 · raw
@line:String -> List<&2, String>
the words of a line
def blank source · line 65 · raw
@+ch:Char -> Bool
a character bend's loader reads as white space in an import line. The
loader trims each line of a file's header and splits an import on \s+,
JavaScript's white space: tab, line feed, vertical tab, form feed, carriage
return and space, the no-break space, and the Unicode space separators, the
line and paragraph separators and the byte order mark. A zero-width space
or a next-line character is not one, and bend refuses an import it holds.
def trim.front.at source · line 76 · raw
@skip:Bool -> @head:Char -> @tail:String -> @rest:(@_:Unit -> String) -> String
the front of a line, past one character that may be blank
def trim.front source · line 84 · raw
@line:String -> String
a line with its leading blanks dropped
def trim.back.at source · line 93 · raw
@gone:Bool -> @head:Char -> @rest:String -> String
a character kept before the rest of a line with its trailing blanks dropped. The character goes too when it is blank and nothing follows it.
def trim.back source · line 102 · raw
@line:String -> String
a line with its trailing blanks dropped, read from the front, so that the trim of a line is a walk over it rather than over its reverse
def trim source · line 111 · raw
@line:String -> String
a line with the blanks at either end dropped, as bend's loader trims it
def cut.put source · line 120 · raw
@field:String -> @after:List<&2, String> -> List<&2, String>
a field put before the fields after it, unless it is empty
def cut.at source · line 129 · raw
@gap:Bool -> @head:Char -> @sofar:Cut -> Cut
one character before the fields read so far: a blank ends the field under way, and anything else extends it
def cut source · line 139 · raw
@line:String -> Cut
a line cut at its blanks, read from the back
def cut.all source · line 147 · raw
@sofar:Cut -> List<&2, String>
a line's fields once it is cut: the one under way before the rest
def fields source · line 154 · raw
@line:String -> List<&2, String>
the fields of an import line: what is left between its runs of blanks, as
bend's loader splits it. words splits on spaces alone, which is how a
manifest line is split.
def word source · line 159 · raw
@ws:List<&2, String> -> @index:Nat -> String
the nth word, or "" when the line is shorter than that. Both the list and the count are scrutinised together, so the walk needs no helper to branch through.
def mod_of.step source · line 173 · raw
@named:Bool -> @ws:List<&2, String> -> Stmt
the line named a module, or it did not, with the answer already in hand.
Bool.pick is an ordinary function and builds both of its arms before it
picks one, so under it word(ws, 1n) walked the words of every line of
every source file ez scans. An arm of a match is not built until it is
taken.
def mod_of source · line 181 · raw
@+ws:List<&2, String> -> Stmt
an import <spec> as <Name> line names a module; anything else does not
def base_of.step source · line 190 · raw
@prelude:Bool -> @ws:List<&2, String> -> Stmt
the prelude decided. The prelude arm does no work at all, and the other arm
is the only place mod_of has anything to say, so this is where the rest of
the classification hangs rather than in an argument that always runs.
def base_of source · line 199 · raw
@+ws:List<&2, String> -> Stmt
import Base brings in the prelude, which is no part of any package. bend
lets a comment follow it, and a comment names no module.
def quiet source · line 207 · raw
@+line:String -> Bool
a line that neither opens nor ends the header
def stmt_of.quiet source · line 215 · raw
@skip:Bool -> @+line:String -> Stmt
a line that says nothing about the header, decided. fields is a walk
over the line that cuts it at its blanks, and this is the arm it hangs
from: every blank line and every comment line of every .bend file of the
project and of every package it resolves used to be split into words and
classified, which is most of the lines ez ever reads.
def foreign.gap.at source · line 223 · raw
@skip:Bool -> @head:Char -> @tail:String -> @rest:(@_:Unit -> String) -> String
the rest of a line, past one character that may be skipped
def foreign.gap source · line 232 · raw
@line:String -> String
a line past its import, with the spaces, tabs and carriage returns bend's
parser skips between the word and the path dropped
def foreign.path source · line 242 · raw
@+rest:String -> String
the quoted path of a foreign import, once its import and the gap after
it are gone
def foreign.quoted source · line 246 · raw
@+rest:String -> Bool
whether what follows a line's import is a quoted path
def stmt_of.foreign source · line 252 · raw
@here:Bool -> @+line:String -> Stmt
the foreign import decided. The rest of the cascade hangs off the False arm rather than sitting in an argument, so a line that is a foreign import pays for nothing below it.
def stmt_of source · line 262 · raw
@+line:String -> Stmt
a trimmed line classified. A foreign import is tested first: it lives in a
def's body, long after the header has ended. bend's parser reads the word
import, skips spaces, tabs and carriage returns, and reads a quoted path.
def scan.mod source · line 269 · raw
@+head:Bool -> @spec:String -> @mods:List<&2, String> -> @foreign:List<&2, String> -> Head
a module named after the header has ended is not part of the header, so the line is ignored rather than followed
def scan.go source · line 277 · raw
@st:Head -> @stmt:Stmt -> Head
the state once a line has been classified
def scan.step source · line 290 · raw
@st:Head -> @raw:String -> Head
one line of a source file against the state
def scan.fin source · line 294 · raw
@st:Head -> Scan
what a finished scan gathered, in source order
def scan.walk source · line 302 · raw
@ls:List<&2, String> -> @st:Head -> Head
the header walked one line at a time. Base's List.foldl applies an erased
function parameter, which Bend's termination check cannot see through, so
every def reaching it is reported as relying on unsafe code; a walk written
out is structural and costs nothing.
def scan source · line 310 · raw
@text:String -> Scan
what a source file's header imports
def scan.mods source · line 314 · raw
@scanned:Scan -> List<&2, String>
the modules a scan found
def scan.foreign source · line 319 · raw
@scanned:Scan -> List<&2, String>
the foreign bodies a scan found
def is_hub source · line 326 · raw
@+spec:String -> Bool
an import of a hub package, which is a dependency rather than a module of
this package. A 0x name has no directory of its own, so the first / ends
it.
def name.char source · line 340 · raw
@+ch:Char -> Bool
a character a hub name holds after its first: a-z, 0-9 and -
def name.chars source · line 344 · raw
@text:String -> Bool
whether every character is one a hub name holds
def name.first source · line 353 · raw
@text:String -> Bool
whether a name opens with a letter
def name.part source · line 362 · raw
@+text:String -> Bool
a hub name: a letter, then a-z, 0-9 and -, 1 to 64 characters in all, as bend's NAMED rule reads it. Which names a Bender may take is the hub's.
def digits source · line 368 · raw
@text:String -> Bool
whether every character is a digit
def ver.num source · line 377 · raw
@+text:String -> Bool
one number of a version: digits, and no leading zero unless it is 0
def ver.nums source · line 383 · raw
@ps:List<&2, String> -> Bool
whether every number of a version is one
def ver.ok source · line 392 · raw
@+text:String -> Bool
a version: four numbers, like 1.0.0.0
def name.ok source · line 398 · raw
@+nv:String -> Bool
whether a <name>@<version> is one the hub rules in, as bend's NAMED
pattern reads it
def named.pick source · line 404 · raw
@named:Bool -> @+first:String -> String
the first component, when it is a name, and "" when it is not
def named.of source · line 414 · raw
@+spec:String -> String
the <name>@<version> an import names, or "" when it names none: the first
component of its normalised path, when that holds an @ and a / follows
it, as bend's loader reads it
def is_named source · line 421 · raw
@+spec:String -> Bool
an import of a named hub package, which is a dependency rather than a module of this package, whether or not the hub rules its name in (EZ-HUB-3)
def unnamed.why source · line 426 · raw
@+nv:String -> String
why a name the hub rules out stops a walk, a lock or a fetch, in bend's own words
def unnamed.pick source · line 431 · raw
@bad:Bool -> @+nv:String -> @rest:(@_:Unit -> String) -> String
the name when the hub rules it out, the rest's otherwise
def unnamed source · line 440 · raw
@ms:List<&2, String> -> String
the first named import of a list whose name the hub rules out, or "" when there is none
def task_of source · line 461 · raw
@+dir:String -> @+nd:String -> @+spec:String -> List<&2, Task>
a module import as the file to visit next, or nothing when it names a hub
package, by its 0x name or by its <name>@<version>
def tasks source · line 466 · raw
@+dir:String -> @+nd:String -> @ms:List<&2, String> -> List<&2, Task>
every module a file imports, as the files to visit next
def nsdir source · line 475 · raw
@+ns:String -> String
the directory a module's own imports are named from. The entry is the package root, so its modules are named from nowhere in particular.
def raw_of source · line 480 · raw
@+ns:String -> @eb:String -> String
the entry file is written under its own base name; every other module under the path it was reached through
def seen.has.step source · line 489 · raw
@here:Bool -> @rest:(@_:Unit -> Bool) -> Bool
one step of the scan, with the head's answer in hand. Bool.or is an
ordinary function and so reduces both of its sides, which means a scan
written with it never stops at the name it was looking for. The rest of the
scan arrives as a thunk and only the arm that wants it applies it. This list
grows by one with every file the walk reaches, so the scan is the inner half
of a quadratic and stopping early halves it.
def seen.has source · line 499 · raw
@xs:List<&2, String> -> @+want:String -> Bool
whether a name is already among the ones the walk has reached. Base's
List.contains applies an erased equality, which falls outside the
termination check; this scan is structural.
def file_of source · line 507 · raw
@+pre:String -> @hit:Found -> Item
a found file, placed under whatever the package re-rooted at
def placed source · line 512 · raw
@+pre:String -> @fs:List<&2, Found> -> List<&2, Item>
every found file, placed
def file.at source · line 520 · raw
@item:Item -> String
where a file sits inside its package
def file.le source · line 526 · raw
@left:Item -> @right:Item -> Bool
a package's files are written in path order, so the manifest of a package is the same text whoever computes it
def dedup.pick source · line 530 · raw
@same:Bool -> @head:Item -> @rest:List<&2, Item> -> List<&2, Item>
the same path twice is the same file twice, and a package holds it once
def dedup.head source · line 538 · raw
@+head:Item -> @rest:List<&2, Item> -> List<&2, Item>
a file against the deduplicated files that follow it
def dedup source · line 546 · raw
@fs:List<&2, Item> -> List<&2, Item>
a sorted file list with the repeats dropped
def file.ins.put source · line 556 · raw
@le:Bool -> @item:Item -> @head:Item -> @tail:List<&2, Item> -> @rest:List<&2, Item> -> List<&2, Item>
where a file goes among the files already in order: before the one it is not after, otherwise behind it. The rest of the insertion is a parameter, because two defs that call each other are not allowed.
def file.ins source · line 564 · raw
@fs:List<&2, Item> -> @+item:Item -> List<&2, Item>
a file inserted into a list already in path order
def file.sort source · line 576 · raw
@fs:List<&2, Item> -> List<&2, Item>
a file list in path order. Insertion rather than Base's List.sort: that one
is a fuelled bottom-up merge sort, whose recursion Bend cannot check, so it
is reported as unsafe and every proof downstream of it inherits the report.
An insertion sort shrinks its list at every step, so Bend checks it, and a
package's file set is small enough that the cost is not felt.
def files_of source · line 584 · raw
@fs:List<&2, Item> -> List<&2, Item>
the files of a package, in path order and each one once
def escapes source · line 588 · raw
@+at:String -> Bool
a path that leaves the package behind, which no package may hold
def escaped.step source · line 595 · raw
@here:Bool -> @at:String -> @rest:(@_:Unit -> String) -> String
one step of the search, with the head's answer in hand. A search that puts
its recursion in an arm of a Bool.pick is not a search: the arm is built
whatever the answer, so the first escaping path still costs a walk of every
file after it. The thunk is what makes the stop a stop.
def escaped source · line 603 · raw
@fs:List<&2, Item> -> String
the first file whose path leaves the package, or "" when none does
def manifest.line source · line 612 · raw
@item:Item -> String
one <sha256> <path> line
def manifest.lines source · line 617 · raw
@fs:List<&2, Item> -> String
every line of a manifest
def manifest_of source · line 626 · raw
@fs:List<&2, Item> -> String
the manifest text is the package's identity, and bend checks a fetched manifest against the first 32 hex characters of its sha256
def hash_of source · line 630 · raw
@fs:List<&2, Item> -> String
the 0x name a file set is published under
def file.lic source · line 636 · raw
@item:Item -> Bool
whether a file of a package is a LICENSE bend took along. A module ends in
.bend and a foreign body in .c or .js, so a file named LICENSE is one
the walk took along beside them.
def bare.pick source · line 640 · raw
@lic:Bool -> @head:Item -> @rest:List<&2, Item> -> List<&2, Item>
def bare source · line 649 · raw
@fs:List<&2, Item> -> List<&2, Item>
a package's files as bend named them before 2.0.27: without the LICENSE files it now takes along, in the order they were given
def bare.srcs.pick source · line 656 · raw
@lic:Bool -> @text:String -> @rest:List<&2, String> -> List<&2, String>
def bare.srcs source · line 665 · raw
@fs:List<&2, Item> -> @ss:List<&2, String> -> List<&2, String>
the texts that go with those files: the texts of a file list, one per file in the same order, with the LICENSE files' texts left out
def inside source · line 729 · raw
@+root:String -> @+path:String -> String
a path of the project, as it is written inside a package rooted at root:
the path itself under the project's own root, and the path with the root's
directories taken off otherwise. The hub serves a package's files at these
paths, so ez add and ez publish both name the entry by it.
def look.step source · line 735 · raw
@hit:Bool -> @text:String -> @rest:(@_:Unit -> Maybe<&2, String>) -> Maybe<&2, String>
one step of a lookup, with the head's answer in hand. The rest arrives as a thunk, so a hit ends the search.
def look source · line 743 · raw
@fs:List<&2, Source> -> @+at:String -> Maybe<&2, String>
a file list's text for a path, first in the list, or None when it has none
def find.asked source · line 752 · raw
@asked:Bool -> Look
a path that was asked for and found missing is not there; one that was not asked for is not given
def find.miss source · line 761 · raw
@whole:Bool -> @gone:List<&2, String> -> @+at:String -> Look
a path the files do not hold: not there in a whole tree, and in a partial one unless it was asked for already
def find.got source · line 769 · raw
@got:Maybe<&2, String> -> @whole:Bool -> @gone:List<&2, String> -> @+at:String -> Look
a path the files hold is here
def find source · line 777 · raw
@tree:Tree -> @+at:String -> Look
what a tree says of a path
def outside source · line 782 · raw
@+at:String -> Bool
a checkout-relative path that climbs above the checkout's top
def beside source · line 790 · raw
@+path:String -> String
the file bend takes along beside every file it publishes: a file named
exactly LICENSE in the same directory, at the same path in the package.
bend 2.0.27 hashes it with the rest, so a package that has one is named
with it.
def license.put source · line 795 · raw
@got:Look -> @+raw:String -> List<&2, Hit>
the LICENSE beside a published file, when the tree holds one, named beside the file's own name in the package
def foreign.put source · line 809 · raw
@got:Look -> @+tree:Tree -> @+at:String -> @+raw:String -> List<&2, Hit>
a foreign body the tree holds, with the LICENSE beside it, or nothing when
it is not there. bend uploads only the ones that are there. It is named the
way the module importing it is named, from that module's own directory:
bend --publish writes src/util/beep.c for a body imported by
src/util/math.bend.
def foreigns source · line 820 · raw
@+tree:Tree -> @+dir:String -> @+nd:String -> @ats:List<&2, String> -> List<&2, Hit>
every foreign body a file imports, named from the importing module's directory
def asked source · line 830 · raw
@got:Look -> @+at:String -> @rest:(@_:Unit -> Stop) -> Stop
a file the walk may need stops it only when it was not given, as a question: one that is there or not there lets the walk go on
def foreign.asked source · line 841 · raw
@got:Look -> @+tree:Tree -> @+at:String -> @rest:(@_:Unit -> Stop) -> Stop
a foreign body inside the checkout stops the walk only when it, or the LICENSE beside it once it is there, was not given
def foreign.judge source · line 851 · raw
@out:Bool -> @+tree:Tree -> @+at:String -> @+raw:String -> @rest:(@_:Unit -> Stop) -> Stop
a foreign body that climbs out of the checkout stops the walk, naming it
def foreign.check source · line 860 · raw
@+tree:Tree -> @+dir:String -> @+nd:String -> @ats:List<&2, String> -> Stop
the first foreign body of a file that stops the walk, or Going when none
does
def visit.put source · line 873 · raw
@fstop:Stop -> @+tree:Tree -> @+sc:Scan -> @+text:String -> @+file:String -> @+ns:String -> @eb:String -> @seen:List<&2, String> -> @out:List<&2, Hit> -> @rest:List<&2, Task> -> State
a file whose LICENSE and foreign bodies are all settled: itself, the LICENSE beside it and its foreign bodies found, and the modules it imports put at the front of the queue, so the walk goes depth first the way bend's does. A foreign body that stops the walk leaves the file queued, so an answered question visits it again.
def named.check.at source · line 909 · raw
@none:Bool -> @nv:String -> @rest:(@_:Unit -> Stop) -> Stop
a file that imports a name the hub rules out stops the walk, naming it, as bend refuses to load it; any other goes on to its foreign bodies
def named.check source · line 916 · raw
@+nv:String -> @rest:(@_:Unit -> Stop) -> Stop
def visit.found source · line 921 · raw
@+tree:Tree -> @+text:String -> @+file:String -> @+ns:String -> @eb:String -> @seen:List<&2, String> -> @out:List<&2, Hit> -> @rest:List<&2, Task> -> State
a file that is in the tree, scanned, with the LICENSE beside it, its named imports and its foreign bodies checked first
def visit.have source · line 940 · raw
@got:Look -> @+tree:Tree -> @+file:String -> @+ns:String -> @eb:String -> @seen:List<&2, String> -> @out:List<&2, Hit> -> @rest:List<&2, Task> -> State
a module that is imported and not there stops the walk, since a package missing a file is not the package bend would publish. One the walk was not given stops it too, as a question, with the module still queued.
def climbs.name source · line 960 · raw
@+ns:String -> @+file:String -> String
the name an import that climbs out is refused under: the path it was reached through, or the entry's own path
def visit.in source · line 965 · raw
@out:Bool -> @+tree:Tree -> @+file:String -> @+ns:String -> @eb:String -> @seen:List<&2, String> -> @outs:List<&2, Hit> -> @rest:List<&2, Task> -> State
a module above the checkout's top is refused rather than read: the package would be named after directories of whatever machine walked it
def visit.go source · line 983 · raw
@hit:Bool -> @+tree:Tree -> @+file:String -> @ns:String -> @eb:String -> @seen:List<&2, String> -> @out:List<&2, Hit> -> @rest:List<&2, Task> -> State
a file already visited keeps the name it was first reached through, the way bend's own walk does
def step.pop source · line 1001 · raw
@+tree:Tree -> @eb:String -> @+seen:List<&2, String> -> @out:List<&2, Hit> -> @stop:Stop -> @queue:List<&2, Task> -> State
the next file of the queue visited, or the walk as it is when the queue is empty
def step source · line 1016 · raw
@+tree:Tree -> @eb:String -> @st:State -> State
the walk as one step that does not recurse
def stop.going source · line 1021 · raw
@stop:Stop -> Bool
whether the walk has not stopped
def walk.done source · line 1037 · raw
@+st:State -> Bool
whether the walk is over: its queue is empty, or it has stopped
def walk.more source · line 1044 · raw
@done:Bool -> @st:State -> @go:(@_:State -> State) -> State
the walk as it is when it is over, or one step further when it is not. The rest of the walk arrives as a function, since a def may not call itself from another def.
def walk.spent source · line 1053 · raw
@done:Bool -> @st:State -> State
the fuel ran out: a walk that is over stays as it is, and one with files still queued is spent, so it is refused rather than hashed short
def walk source · line 1063 · raw
@fuel:Nat -> @+tree:Tree -> @+eb:String -> @+st:State -> State
every file of the package reached from the entry, the step iterated under fuel, until the walk is over or stops
def start source · line 1071 · raw
@+entry:String -> State
the walk before its first step: the entry queued, under no name of its own
def hit.sum source · line 1078 · raw
@item:Hit -> Found
a found file weighed: its name and the sha256 of its text
def hit.sums source · line 1083 · raw
@fs:List<&2, Hit> -> List<&2, Found>
every found file weighed
def laid.one source · line 1091 · raw
@+pre:String -> @item:Hit -> Source
a found file placed under whatever the package re-rooted at, with its text
def laid source · line 1096 · raw
@+pre:String -> @fs:List<&2, Hit> -> List<&2, Source>
every found file placed, with its text
def laid.sum source · line 1105 · raw
@src:Source -> Item
a laid file weighed: its path and the sha256 of its text. This is what a
plan's reader would compute from the files a Lay writes.
def laid.sums source · line 1110 · raw
@fs:List<&2, Source> -> List<&2, Item>
every laid file weighed
def hit.ups source · line 1118 · raw
@item:Hit -> Nat
how far a found file climbs out of the entry's directory
def climb source · line 1123 · raw
@fs:List<&2, Hit> -> Nat
the deepest climb any file of the package makes
def made.judge source · line 1131 · raw
@ok:Bool -> @+bad:String -> @+root:String -> @+pre:String -> @+fs:List<&2, Item> -> @out:List<&2, Hit> -> Walked
the found files named, once no path escapes the package
def made.placed source · line 1147 · raw
@+root:String -> @+pre:String -> @+out:List<&2, Hit> -> Walked
the found files, placed under the components the package re-roots under and weighed once
def license.is source · line 1155 · raw
@+part:String -> Bool
whether a component is named license in any case. bend 2.0.27 refuses to publish a file under such a directory, since on a disk that does not tell case apart it is the same name as a LICENSE file beside it.
def license.step source · line 1160 · raw
@here:Bool -> @rest:(@_:Unit -> Bool) -> Bool
one step of the search, with the head's answer in hand; the rest arrives as a thunk, so a hit ends the search
def license.any source · line 1168 · raw
@ps:List<&2, String> -> Bool
whether any of the components is named license
def license.under source · line 1176 · raw
@+at:String -> Bool
whether a path of the package lies under a directory named license
def licensed.step source · line 1180 · raw
@here:Bool -> @+at:String -> @rest:(@_:Unit -> String) -> String
one step of the search for such a path
def licensed source · line 1190 · raw
@+pre:String -> @fs:List<&2, Hit> -> String
the first found file whose place in the package lies under a directory named license, or "" when none does. It reads names alone, so nothing is weighed for it.
def made.lic source · line 1200 · raw
@ok:Bool -> @+bad:String -> @+root:String -> @+pre:String -> @+out:List<&2, Hit> -> Walked
the found files placed and weighed, once none lies under a directory named license, which bend refuses before it mines
def made.checked source · line 1209 · raw
@+root:String -> @+pre:String -> @+out:List<&2, Hit> -> Walked
the found files, refused when one lies under a directory named license, and placed and weighed otherwise
def made.anc source · line 1217 · raw
@far:Bool -> @+levels:Nat -> @+dir:String -> @+out:List<&2, Hit> -> Walked
a package that climbs re-roots under as many of the entry directory's trailing components as its deepest climb. The walk refuses an import that climbs out of the checkout, so there are always that many; a package that still climbs further is refused rather than named after nothing.
def comps source · line 1226 · raw
@+dir:String -> Nat
how many components a checkout-relative directory has: none for the checkout's top
def made.climb source · line 1232 · raw
@+levels:Nat -> @+dir:String -> @+out:List<&2, Hit> -> Walked
the deepest climb decided: none leaves the package at the entry's directory
def made.go source · line 1241 · raw
@stop:Stop -> @+entry:String -> @+out:List<&2, Hit> -> Walked
the walk's end judged: a walk that is over is the package, one that asks is a question, and every other stop is a refusal naming what stopped it
def made source · line 1257 · raw
@+entry:String -> @st:State -> Walked
the walk's end, judged
def of.tree source · line 1263 · raw
@fuel:Nat -> @+entry:String -> @+tree:Tree -> Walked
the package an entry of a tree would be published as, from the tree's files alone, with this much fuel
def of.fuel source · line 1267 · raw
@fuel:Nat -> @+entry:String -> @+fs:List<&2, Source> -> Walked
the same over a whole checkout
def walk.fuel source · line 1274 · raw
@fs:List<&2, Source> -> Nat
fuel enough for a walk over these files: one step for the entry and one for every import it can queue, and every import is a line of some file. A function of the files rather than a number, so no checkout is too big for it and a proof about files it does not know leaves it unevaluated.
def of source · line 1282 · raw
@+entry:String -> @+fs:List<&2, Source> -> Walked
the same, with fuel enough for every file of the checkout
def tree.gone source · line 1289 · raw
@tree:Tree -> @at:String -> Tree
a path read and found missing, added to what the walk was given
def tree.have source · line 1294 · raw
@tree:Tree -> @src:Source -> Tree
a file read, added to what the walk was given
def tree.add source · line 1299 · raw
@got:Maybe<&2, String> -> @tree:Tree -> @+at:String -> Tree
what a read answered, added to what the walk was given
def resume source · line 1307 · raw
@st:State -> State
a walk that stopped to ask, taken up again where it stopped
def state.stop source · line 1312 · raw
@st:State -> Stop
why a walk stopped
def made.io source · line 1318 · raw
@+top:String -> @got:Walked -> IO(Pkg)
a walk's verdict as a package, with its root taken back under the checkout it was read from
def pkg.next source · line 1328 · raw
@stop:Stop -> @+top:String -> @+entry:String -> @+tree:Tree -> @+st:State -> @go:(@_:Tree -> @_:State -> IO(Pkg)) -> IO(Pkg)
a question read from disk and the walk carried on, or the walk's end judged
def resumed.fuel source · line 1355 · raw
@+tree:Tree -> @+st:State -> Nat
fuel enough for a walk taken up again over the files read so far: a step
for every file still queued, and walk.fuel's step for every import those files
can queue
def asks source · line 1364 · raw
Nat
how many files the walk from disk may ask for. It asks for one file a round and cannot know how many the checkout holds until it has read them, so this is a guard against a walk that keeps asking, not a limit on a package: a package of more files than this is refused, never hashed short.
def pkg.ask source · line 1369 · raw
@fuel:Nat -> @+top:String -> @+entry:String -> @+eb:String -> @+tree:Tree -> @+st:State -> IO(Pkg)
the walk over what has been read so far, and each file it asks for read and handed back, until it no longer asks
def walk.io source · line 1381 · raw
@+top:String -> @+entry:String -> IO(Pkg)
the package an entry would be published as, walked over its checkout: the
entry and every file the walk reaches are paths from top, read from disk
as the walk asks for them. An import that climbs above top is refused.
def pkg_in source · line 1386 · raw
@+top:String -> @+entry:String -> IO(Pkg)
the package an entry of a checkout would be published as
def pkg.from source · line 1391 · raw
@abs:Bool -> @+entry:String -> IO(Pkg)
an entry named from the working directory is walked over the working directory, and one named from the root over the whole file system
def pkg_of source · line 1402 · raw
@+entry:String -> IO(Pkg)
the package an entry file would be published as: every module it reaches, every foreign body beside them, and the hash over their manifest. A relative entry's checkout is the working directory, which is the project a command runs in.
def pkg.hash source · line 1406 · raw
@package:Pkg -> String
the hash that names a package
def pkg.root source · line 1411 · raw
@package:Pkg -> String
the directory a package's file paths are written from
def pkg.files source · line 1416 · raw
@package:Pkg -> List<&2, Item>
the files a package holds
def file.sum source · line 1421 · raw
@item:Item -> String
the sha256 recorded for a file