Skip to main content

Module cli

Module cli 

Source
Expand description

decl check / decl evaluate / decl validate / decl fmt (cli.ts). Output is byte-identical to the reference implementation’s CLI so the three implementations can be diffed (tests/parity/differential.py).

Functions§

check_files
decl check: load each entry (following imports), report load diagnostics and every module’s static findings, tagged with their file
evaluate
decl evaluate: (exit code, the document for stdout, diagnostics tagged with the file each is reported against, bare stderr lines to print after them). What to emit, and where (§5.5): each --output name[=file] names a root — an output, or an input bound by –input or demanded through its fallback — and the file its document goes to (stdout without one); with no –output, the entry module’s exported outputs, as one object keyed by name, on stdout
file_tag
the file a diagnostic is reported against: the entry module by the path given on the command line, any other module by its absolute path
input_binds
the documents named by --input, each bound to the module that declares its input (§10): name=doc.json; Err carries the exit code of a usage error (already printed) the documents named by –input, each bound to the module that declares its input (§10): name=doc.json. A usage error (bad spec, unknown input) is printed and returned as exit 2; a document that cannot be read or is not well-formed JSON is returned as one E6004 diagnostic (exit 1)
main
the command line: returns the process exit code
open_universe
the module graph of an entry file inside its package universe (manifest and lock diagnostics first), as the reference CLI opens it
validate_file
single-file validation, module-aware like check and evaluate: load the universe, check every module, then evaluate with the --input documents bound (none bound is fine: fallbacks apply). Diagnostics come tagged with the file each is reported against; Err carries a usage exit code as a negative