build: single-file bundles build/Rosetta.luau + build/rosetta.lua (tools/bundle.py), terse README with generated format / codec tables

- tools/bundle.py: every module a function in __FILES with a cached __include; requires become __include
  calls, so only the API and its load-time requires run on require. Rosetta._internal(path) includes any
  module by its src path. --!native modules get @native on each function (NATIVE re-checked on the bundle);
  linemaps map bundle lines back to sources (--where). LuaJIT bundle inlines the compat prelude.
- tools/build.py: the multi-file trees move to build/_modules (gitignored); each target also writes its bundle.
- tools/test.sh: api + docs/example tests also run against both bundles; fails when build/ is stale.
- default.project.json mounts build/Rosetta.luau; examples/love loads build/rosetta.lua.
- README: one line, install, quick start, doc links, generated format table and codec list
  (tools/gen_registry.py), licence TODO. DOCS lint checks the generated sections and the links.
This commit is contained in:
4DBug committed 2026-11-01 01:00:35 -06:00
1 parent 0bd7b87d2b
commit bcf6d46fb7
16 files changed
+399611 -210

No files matched your search

+13 -18
View File
@@ -41,34 +41,29 @@ as `F`, and its input files as variables such as `pngBytes` (a buffer) or `srtTe
## Installing
**Roblox (Rojo).** Build the Roblox tree, then let Rojo turn it into a model or sync it into Studio:
```sh
python3 -I tools/build.py roblox # writes build/roblox/Rosetta (requires become instance paths)
rojo build -o Rosetta.rbxm # default.project.json mounts build/roblox/Rosetta; or: rojo serve
```
Put the `Rosetta` ModuleScript somewhere both client and server can see it, for example ReplicatedStorage:
**Roblox.** The library is one ModuleScript, [`build/Rosetta.luau`](../../build/Rosetta.luau) (committed; rebuilt by
`python3 -I tools/build.py roblox`). Paste it into a ModuleScript named `Rosetta`, or mount it with Rojo
(`"Rosetta": { "$path": "rosetta/build/Rosetta.luau" }`; this repository's `default.project.json` does, so
`rojo build -o Rosetta.rbxm` or `rojo serve` works from here). Put it where both client and server can see it, for
example ReplicatedStorage:
<!-- doc:display needs Roblox -->
```luau
local F = require(game:GetService("ReplicatedStorage").Rosetta)
local Mpeg1 = F._internal("codecs/video/Mpeg1") -- an internal module, by its path under src/Rosetta
```
Roblox has no file system: pass buffers or strings, for example from `HttpService:GetAsync` or a `buffer` you built.
Requiring it runs only the API and what it needs at load time; every format and codec runs on first use. Roblox has
no file system: pass buffers or strings, for example from `HttpService:GetAsync` or a `buffer` you built.
**LuaJIT and LÖVE.** Build the Lua 5.1 tree:
```sh
python3 -I tools/build.py luajit # writes build/luajit/rosetta/ (plain Lua 5.1 + the LuaJIT FFI)
```
Then either copy `build/luajit/rosetta` into your game, or put the build on `package.path`:
**LuaJIT and LÖVE.** The library is one file, [`build/rosetta.lua`](../../build/rosetta.lua) (plain Lua 5.1 + the
LuaJIT FFI; rebuilt by `python3 -I tools/build.py luajit`). Copy it into your game and require it from a folder on
`package.path`, or load it with `dofile`:
<!-- doc:display plain LuaJIT code -->
```lua
package.path = "build/luajit/?.lua;build/luajit/?/init.lua;" .. package.path
local F = require("rosetta")
package.path = "build/?.lua;" .. package.path
local F = require("rosetta") -- or: local F = dofile("build/rosetta.lua")
```
The library carries its own copy of the Luau standard library pieces it uses (`buffer`, `bit32`, `utf8`, ...).