ws-arch2: groundwork: Types.BitmapStrike / BitmapGlyph + Font.bitmap (optional field), codecs/font/Bitmap (bitmap Font value, strike of any font, 1-bit row pack/unpack), api unwrap of meta.payload entries (a .deb loads as its data.tar.*; meta.container / meta.outer)

Types.luau: additive only (new optional Font field and two new types). init.luau: unwrap() also follows
meta.payload = <entry name> on non-stream archives; stream behaviour unchanged.
This commit is contained in:
4DBug committed 2026-10-31 13:51:09 -05:00
1 parent de4f14a343
commit 51117f9732
5 files changed
+324 -6

No files matched your search

+18 -6
View File
@@ -224,19 +224,26 @@ end
-- single-stream archives (gzip / zst / xz / bz2 / br: meta.stream) whose one entry sniffs as another archive (a
-- .tar.gz) load as that inner archive, with meta.compression = the outer format. opts.unwrap = false keeps the outer
-- one; an explicit opts.format also does.
-- one; an explicit opts.format also does. Package archives name their payload entry in meta.payload (a .deb's
-- data.tar.xz): they load as that inner archive too, with meta.container = the outer format and meta.outer = the
-- outer archive (its control data).
local function unwrap(value: any, formatName: string, o: Options): any
if o.unwrap == false or o.format ~= nil or (o._depth or 0) >= 3 then
return value
end
if type(value) ~= "table" or value.kind ~= "archive" or type(value.meta) ~= "table" or not value.meta.stream then
if type(value) ~= "table" or value.kind ~= "archive" or type(value.meta) ~= "table" then
return value
end
local payload = value.meta.payload
if not value.meta.stream and type(payload) ~= "string" then
return value
end
local ok, list = pcall(value.list, value)
if not ok or type(list) ~= "table" or #list ~= 1 then
if not ok or type(list) ~= "table" or (#list ~= 1 and type(payload) ~= "string") or #list == 0 then
return value
end
local rok, inner = pcall(value.read, value, list[1].name)
local entryName = if type(payload) == "string" then payload else list[1].name
local rok, inner = pcall(value.read, value, entryName)
if not rok or type(inner) ~= "buffer" then
return value
end
@@ -246,13 +253,18 @@ local function unwrap(value: any, formatName: string, o: Options): any
end
local io = table.clone(o)
io.category = "archive"
io.name = list[1].name
io.name = entryName
io._depth = (o._depth or 0) + 1
local v = load(inner, io)
if type(v) ~= "table" or type(v.meta) ~= "table" then
return value
end
v.meta.compression = formatName
if type(payload) == "string" then
v.meta.container = formatName
v.meta.outer = value
else
v.meta.compression = formatName
end
return v
end