Skip to main content

Module bundle

Module bundle 

Source
Expand description

.lpak resource bundle: a zip-like archive that ships an entire Lumen app’s assets (main.lmn, main.css, scripts, images, fonts) as a single file. Mirrors Qt’s qrc and GTK’s GResource.

The on-disk format is intentionally tiny - no compression, no checksums, just a header table and a packed payload region. The goal is a lumenc bundle <dir> <out.lpak> round trip that’s comprehensible at a hex dump:

    +-----------+----------------+-------------------+
    | magic     | "LMNB"         | 4 bytes           |
    | version   | u32 LE         | 4 bytes           |
    | file_count| u32 LE         | 4 bytes           |
    +-----------+----------------+-------------------+
    | entry[0]  | name_len: u32  | 4 bytes           |
    |           | name: utf-8    | name_len bytes    |
    |           | offset: u64    | 8 bytes           |
    |           | size: u64      | 8 bytes           |
    +-----------+----------------+-------------------+
    | ...         | ...              | ...                 |
    +-----------+----------------+-------------------+
    | file_bytes[0]              | size bytes        |
    | file_bytes[1]              | size bytes        |
    | ...                          | ...                 |
    +-------------------------------------------------+

All multi-byte integers are little-endian. Offsets are absolute byte positions into the bundle blob.

Structs§

LumenBundle
In-memory .lpak archive. Holds the raw blob plus an index from virtual path -> byte range so reads are O(1).

Enums§

BundleError
Errors produced when opening / reading a .lpak.

Constants§

MAGIC
4-byte magic prefix identifying a .lpak archive. ASCII “LMNB”.
VERSION
Format version. Bumped on incompatible header changes.

Functions§

parse_lumen_uri
Parse a lumen://app/<path> URI and return the <path> portion (suitable for LumenBundle::read). Returns None for any other scheme.