ws-polish: README / STYLE module lists and format counts from the tree, checked by a DOCS lint rule

tools/lint_rules.py DOCS: the README and STYLE layout blocks must name every codecs/<domain>/<Name>,
containers/ and core/ module; README's format counts must match docs/FORMATS.md; the guide index must
link every guide page. STYLE's 'use what exists' table lists the wave-3 shared modules.
This commit is contained in:
4DBug committed 2026-10-31 17:16:08 -05:00
1 parent 42e96a0964
commit 84fb8f42f1
4 files changed
+132 -37

No files matched your search

+39 -28
View File
@@ -5,10 +5,11 @@ generation) and on **LuaJIT / LÖVE** (through `tools/build.py`). Every format o
(`src/Formats/Types.luau`): a PNG and a WebP both load as an `Image`, every audio format opens as the same streaming
`Decoder`, every model format loads as a `Scene`.
About 76 formats across images, audio, video, 3D models, CAD, fonts, archives, data, vector graphics, layered images,
subtitles, music and playlists: see [docs/FORMATS.md](docs/FORMATS.md) (generated from the code) for the list and each
format's capabilities, [docs/API.md](docs/API.md) for the whole API, and the guide
([docs/guide/README.md](docs/guide/README.md)) for walkthroughs.
174 formats: images (25), audio (21), video (11), 3D models (32), CAD (1), fonts (11), archives (31), data (11),
vector graphics and tile maps (2), layered images (3), subtitles (3), music (20) and playlists (3). See
[docs/FORMATS.md](docs/FORMATS.md) (generated from the code) for the list and each format's capabilities,
[docs/API.md](docs/API.md) for the whole API, and the guide ([docs/guide/README.md](docs/guide/README.md)) for
walkthroughs. `tools/lint.sh` checks these counts against the registry.
```luau
local F = require(Formats) -- LuaJIT: require("formats"); luau CLI: require("@formats")
@@ -41,33 +42,38 @@ standard library pieces come from `formats/_compat.lua`). Copy the `formats` fol
## Quick start
```luau
-- images: PNG / APNG, JPEG, WebP, GIF, BMP, TGA, QOI, TIFF, ICO, PNM, HDR -> Image (rgba8 pixels in a buffer)
-- images: PNG / APNG, JPEG, WebP, GIF, BMP, TGA, QOI, TIFF, ICO, PNM, HDR, EXR, DDS, KTX, PCX, ... -> Image
local img = F.image.load(pngBytes)
print(img.width, img.height, #(img.frames or {}), img.loops) -- animations: frames; loops = play count, 0 forever
local jpg = F.save(img, nil, { format = "jpeg", quality = 85 })
-- audio: WAV, FLAC, MP3 / MP2, Ogg Vorbis, Opus, AAC, M4A, AIFF, AU, CAF, VOC -> streaming Decoder or Audio
-- audio: WAV, FLAC, MP3 / MP2, Ogg Vorbis, Opus, AAC, M4A, AIFF, AU, CAF, VOC, WavPack, APE, TTA, Musepack, AC-3,
-- QOA, ADPCM (ADX, VAG, BRSTM, ...) -> streaming Decoder or Audio
local dec = F.audio.open(flacBytes) -- dec:read(n) -> interleaved f32 buffer, frames; dec:seek(s)
local song = F.audio.load(mp3Bytes) -- Audio { sampleRate, channels, frames, samples, tags }
local mono = F.ops.audio.downmix(song, 1) -- channels are in WAVE order; tags keys are lower case
local opus = F.save(F.ops.audio.resample(mono, 48000), nil, { format = "opus", bitrate = 64000 })
-- video: MP4 / MOV, MKV / WebM, AVI, MPEG-TS / PS, Y4M (+ animated images) -> VideoDecoder
-- video: MP4 / MOV, MKV / WebM, AVI, MPEG-TS / PS, Ogg Theora, FLV, FLI, Smacker, Y4M (+ animated images)
-- -> VideoDecoder
local v = F.video.open(mp4Bytes) -- v:nextFrame() -> frame (image yuv420p or rgba8, pts)
-- models: glTF / GLB (+ Draco), OBJ, STL, PLY, FBX, Collada, 3MF, USDA, OFF, VOX, 3DS, MS3D, LWO, .x, IQM, B3D,
-- PMX / PMD, VRML, X3D, LDraw -> Scene
-- PMX / PMD, VRML, X3D, LDraw, MD2 / MD3 / MDL / MD5, BSP, SMD, Roblox (rbxm / rbxmx / .mesh),
-- Minecraft (.schem, .mca), Qubicle -> Scene
local scene = F.model.load(glbBytes)
local prim = F.ops.mesh.merge(scene) -- one triangle primitive in world space
-- fonts, archives, data, vector, layered, subtitles, music, playlists
local font = F.font.load(ttfBytes) -- outlines, metrics, kerning
local zip = F.archive.load(zipBytes) -- entries; F.archive.save writes zip / tar / gzip
local t = F.data.load('{"a": [1, 2]}', { format = "json" }) -- JSON, XML, YAML, TOML, CSV, INI, plist, msgpack, CBOR
local icon = F.ops.vector.rasterize(F.vector.load(svgText), 64, 64)
local flat = F.ops.layers.flatten(F.layered.load(psdBytes))
local subs = F.subtitle.load(srtText)
local tune = F.music.load(modBytes) -- MOD / S3M / XM / IT / MIDI, rendered to audio on request
-- CAD, fonts, archives, data, vector, tile maps, layered, subtitles, music, playlists
local font = F.font.load(ttfBytes) -- TTF / OTF, WOFF / WOFF2, BMFont, bitmap fonts: outlines, kerning
local zip = F.archive.load(zipBytes) -- zip, tar, 7z, gzip, cab, iso, ...; saves zip / tar / gzip
local t = F.data.load('{"a": [1, 2]}', { format = "json" }) -- JSON, XML, YAML, TOML, CSV, INI, plist, CBOR, NBT, ...
local icon = F.ops.vector.rasterize(F.vector.load(svgText), 64, 64) -- SVG; Tiled maps load as a TileMap
local flat = F.ops.layers.flatten(F.layered.load(psdBytes)) -- PSD, Aseprite, OpenRaster
local subs = F.subtitle.load(srtText) -- SRT, WebVTT, ASS / SSA
local tune = F.music.load(modBytes) -- MOD / S3M / XM / IT / AHX / MIDI, ...: rendered to audio
local step = F.cad.load(stepText) -- STEP entity graph (B-rep through a plug-in)
local list = F.playlist.load(m3uText) -- M3U / M3U8, PLS, XSPF
```
## The API in short
@@ -100,20 +106,25 @@ hands to formats (decodeImage / encodeImage / openAudio / plugins): [docs/API.md
```
src/Formats/
init.luau Registry.luau (generated) api: F.*
ops/ editing on the standard types (ImageOps, MeshOps, LayerOps, AudioOps)
ops/ editing on the standard types (ImageOps, MeshOps, LayerOps, AudioOps, ...)
<category>/<fmt>/ formats: only what is specific to the format (parsing, mapping, writing)
containers/ Chunks, Riff, IsoBmff, Ebml, Ogg, Zip, Tar, Avi, MpegTs, MpegPs, ...
codecs/compress/ Deflate, Lzma, Zstd, Brotli, Bzip2, Lzw
codecs/entropy/ Huffman, RangeCoder
codecs/image/ Jpeg, Dct, Vp8, Vp8L, Pixels, Yuv, Quantize, Raster, Blend
codecs/audio/ Opus, Vorbis, Flac, Mpa (MP1-3), Aac, Alac, Mdct, Pcm, Stream, Resample,
VorbisComment, Tracker, SoundFont
codecs/video/ H264, Mpeg1, Video (the codec registry)
codecs/text/ codecs/font/ codecs/model/ Json, Xml, Text, Url / TrueType, Cff / Mat4, MeshFlatten, Draco,
Sampler, Vrml, Rig
containers/ Archive AudioWrap Avi Chunks Cpio Demux Ebml Fat Iso9660 IsoBmff MacFile
MpegEs MpegPs MpegTs Ogg Riff Tar Zip
codecs/compress/ Brotli Bzip2 Deflate Explode Lz4 Lzh Lzma Lzw Lzx PackBits Quantum
UnixCompress Xxh32 Zstd
codecs/entropy/ Huffman RangeCoder
codecs/image/ Bcn Blend Dct Etc Half Jpeg Pixels Quantize Raster Texel Texture Vp8 Vp8L Yuv
codecs/audio/ Aac Ac3 Adpcm Alac Ape ApeTag Flac Hively Mdct MidiRender Mpa (MP1-3)
Musepack Opus Pcm Qoa Resample SoundFont Stream Tracker Tta Vorbis
VorbisComment WavPack
codecs/video/ Dsp H263 H264 Legacy (FLI, Cinepak, MSV1, QT RLE, SMC, Smacker) Mpeg1 Mpeg2
Theora Video (the codec registry)
codecs/text/ Json Nbt Text Url Xml
codecs/font/ Bitmap Cff GlyphNames TrueType
codecs/model/ Draco Mat4 MeshFlatten Minecraft Polygon Rbx Rig Sampler Vrml
host/ runtime adapters (only the api uses them)
Types.luau the standard types + constructors
core/ Bytes, Bits, Err, Crc32, Adler32, Base64, Md5, Input, Sniff
core/ Adler32 Base64 Bits Bytes Crc16 Crc32 Err Input Md5 Sniff
compat/luajit.lua tools/ tests/ (T.luau, <category>/<fmt>.luau, codecs/, containers/, gen/) docs/ licenses/
examples/love/
```
@@ -125,7 +136,7 @@ How the layers fit, the format contract, and what belongs in a format folder: [d
```sh
bash tools/test.sh # fixtures, registry, build, every test under luau --codegen -O2 and LuaJIT, lint
bash tools/test.sh png # one test (both runtimes), no lint
bash tools/lint.sh # globals, type baseline, headers, requires, native-throw, layers, deps, contract, DUP
bash tools/lint.sh # globals, types, headers, requires, native-throw, layers, deps, contract, DUP, docs
bash tools/bench.sh # throughput on both runtimes (pin it: taskset -c 2 bash tools/bench.sh)
python3 -I tools/build.py # build/roblox + build/luajit
python3 -I tools/gen_registry.py # src/Formats/Registry.luau + docs/FORMATS.md from the format folders