Add a package manager: rex init/add/remove/get/update/deps
Packages come from git (a registry can be added later; a bare version in rex.toml is reserved for it). rex.toml [deps] names them, rex.lock pins exact commits, and run/build/check/test download what is missing. `import json` reads the package's json.rex; package files get `@json...` module keys so they never mix with the project's own files. Newest tag of the same major version wins when packages disagree. The language server reads downloaded packages. Docs: docs/14-packages.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
300d767124
commit
15da1e2379
16 files changed
+1588
-61
No files matched your search
@@ -124,6 +124,7 @@ import tools.fs // tools/fs.rex, used as fs.name
|
||||
import ..shared // ../shared.rex (...x = two folders up)
|
||||
// rex.toml in the top folder: imports count from there, in every file
|
||||
import os // built-in: os math time rand
|
||||
import json // a package: `rex add git.joji.li/joji/json` (see chapter 14)
|
||||
pub func f() {} // visible to other files
|
||||
```
|
||||
|
||||
@@ -147,6 +148,8 @@ lib.fill(buf, n) // T* parameters take a variable or a list
|
||||
## Commands
|
||||
`rex run f.rex args…` · `rex build f.rex -o out` · `rex check f.rex` · `rex test [path]` · `rex emit-c f.rex` · `rex fmt path` (`--check` to only report) · `rex lsp` (editor server) · `rex header x.h [word]` (what a C header offers)
|
||||
|
||||
Packages: `rex init` · `rex add git.host/owner/name[@v1.2.0]` (or `../folder`) · `rex remove name` · `rex update [name]` · `rex get` · `rex deps`
|
||||
|
||||
## Things that stop the program (exit code 2)
|
||||
Divide by zero · list index/slice out of range · `pop` on an empty list · reading a missing
|
||||
map key with `m[k]` · using a `nil` or gone `weak` value · calling a `nil` function or interface ·
|
||||
|
||||
Reference in new issue
Block a user