Resolve the multi-file Zig import graph of a file-mode body so it compiles inside the content-addressed cache directory.
A file-mode body is inlined into the generated source.zig, so its
@import("util.zig") statements resolve relative to source.zig's
location. To make a body's relative imports resolve, the imported files
are reproduced inside the cache entry at their paths relative to the body
file. source.zig is the module root, so its directory is the module
path; sibling and subdirectory imports resolve and may themselves use
.. as long as they stay within it. An import that escapes the body's
directory hits Zig's own "import outside module path" rule, exactly as
it would were the body compiled directly as a root file.
scan is pure; closure reads the filesystem.
Resolve the multi-file Zig import graph of a file-mode body so it
compiles inside the content-addressed cache directory.
A file-mode body is inlined into the generated `source.zig`, so its
`@import("util.zig")` statements resolve relative to `source.zig`'s
location. To make a body's relative imports resolve, the imported files
are reproduced inside the cache entry at their paths relative to the body
file. `source.zig` is the module root, so its directory is the module
path; sibling and subdirectory imports resolve and may themselves use
`..` as long as they stay within it. An import that escapes the body's
directory hits Zig's own "import outside module path" rule, exactly as
it would were the body compiled directly as a root file.
`scan` is pure; `closure` reads the filesystem.(closure body-path body-text)The relative .zig files a file-mode body imports, reproduced as paths
relative to the body's directory. body-path is the resolved body file
and body-text its content. Returns {:files [{:rel <path under the body's directory> :text <content>}...]} for every relative .zig
transitively imported within the body's directory, sorted by path. The
body itself is not included; it is inlined into source.zig. An import
that does not resolve to a file, or that escapes the body's directory, is
left out for the Zig compiler to report against the import line. Shell:
reads the filesystem.
The relative `.zig` files a file-mode body imports, reproduced as paths
relative to the body's directory. `body-path` is the resolved body file
and `body-text` its content. Returns `{:files [{:rel <path under the
body's directory> :text <content>}...]}` for every relative `.zig`
transitively imported within the body's directory, sorted by path. The
body itself is not included; it is inlined into `source.zig`. An import
that does not resolve to a file, or that escapes the body's directory, is
left out for the Zig compiler to report against the import line. Shell:
reads the filesystem.(scan zig-text)The relative .zig files a body imports by path: every
@import("...") target that names a relative .zig file. Compiler
modules (std, builtin), absolute paths, and non-.zig targets are
not files to reproduce and are skipped. Pure.
The relative `.zig` files a body imports by path: every
`@import("...")` target that names a relative `.zig` file. Compiler
modules (`std`, `builtin`), absolute paths, and non-`.zig` targets are
not files to reproduce and are skipped. Pure.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |