forked from Botanical/BotanJS
Deprecating old approach
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# botanres-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
|
||||
go run ./cmd/botan-gen \
|
||||
-src /path/to/BotanJS/src \
|
||||
-out internal/generated/classmap_gen.go
|
||||
```
|
||||
|
||||
Commit the generated file if the source tree is mostly static. Generate it in CI if the source changes frequently.
|
||||
|
||||
## Run API
|
||||
|
||||
```sh
|
||||
go run ./cmd/botan-api -src /path/to/BotanJS/src -addr :8080
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
- Test against the old python resolver output
|
||||
- Add an output interface so JS can be piped directly to a Closure Compiler server.
|
||||
- Put generated classmap in a separate package if multiple services need to import it.
|
||||
Reference in New Issue
Block a user