forked from Botanical/BotanJS
45 lines
1.4 KiB
Markdown
45 lines
1.4 KiB
Markdown
# resolver-go
|
|
|
|
Go rewrite for the old BotanJS dynamic resource resolver.
|
|
|
|
1. `cmd/botan-gen` scans the JS tree and generates `internal/generated/classmap_gen.go`.
|
|
2. `internal/resolver` resolves requested classes in memory.
|
|
3. `cmd/botan-api` accepts the old-ish URL shape and returns merged JS/CSS content or a hash filename.
|
|
4. Closure/YUI compression is not in this skeleton. The returned merged JS is the right handoff point for a Closure Compiler server.
|
|
|
|
## Generate the class map
|
|
|
|
```sh
|
|
make resolver-gen
|
|
```
|
|
|
|
Commit the generated file if the source tree is mostly static. Generate it in CI if the source changes frequently.
|
|
|
|
## Run API
|
|
|
|
```sh
|
|
make run-api-server
|
|
```
|
|
|
|
Examples:
|
|
|
|
```sh
|
|
curl 'http://127.0.0.1:8080/rjs/System'
|
|
curl 'http://127.0.0.1:8080/rcss/BotanJS.Core.Main'
|
|
curl 'http://127.0.0.1:8080/hjs/BotanJS.Core.Main'
|
|
```
|
|
|
|
Requests support `/` separated plain names, e.g. `A.B.C/A.B.D`, plus old compressed base64+zlib comma-separated payloads.
|
|
Prefix an item with `-` to exclude it.
|
|
|
|
## What is intentionally different from the Python version
|
|
|
|
- No XML tree. Symbols are flattened by full namespace name.
|
|
- No per-request classmap reload. Regenerate and restart/redeploy instead.
|
|
- No background compressor. This is a resolver/merger only.
|
|
- Hashes use SHA-1 per file for change detection, then MD5 over the resolved hash list for compatibility-style output names.
|
|
|
|
## TODO
|
|
|
|
- Fix moderen closure errors
|