Expand description
A module’s web half: the web/ directory of a [dependencies] entry,
holding a lumen-addon.toml.
Every dependency is a module, and a module has up to two halves. Its
desktop half is the library the loader opens (or finds compiled in). Its
web half is data, not a library: a JavaScript module a page loads beside
the runtime, with optional stylesheets, a script that runs before the page
paints, and files the module reads, all described by the descriptor at the
root of web/:
[addon]
namespace = "echo"
module = "echo.js"
styles = ["echo.css"]
[[function]]
name = "shout"
params = ["text: string"]
returns = "string"
[[function]]
name = "later"
params = ["text: string", "ms: int"]
async = "on_echo"
[[element]]
tag = "echo-view"
html = "div"A web build takes the web half of every dependency and refuses one that
has none; every other build loads the library and never reads web/. The
directory is found the same way for every source: under the module’s root,
which is the directory a path source names, the package a version
source unpacked to, or the toolchain’s copy of a bundled module.
Reading one is a compile’s job: the descriptor becomes the
lumen_ir::addon::Addon the compiled app carries, and the files become
the site’s. No engine opens anything here.
Structs§
- Addon
Package - An add-on read off disk: what the compiled app carries, and the files the site ships.
Constants§
- ADDON_
MANIFEST - The descriptor’s file name, at the root of a module’s web half.
- RESERVED_
EXPORTS - Module exports an add-on cannot name a function after, because the page reads them as the module’s own hooks.
- RESERVED_
NAMESPACES - Script namespaces an add-on cannot take: the runtime’s own, the embedder’s, and the one candela keeps for its standard library.
- WEB_DIR
- The directory a module keeps its web half in, under its root.
Functions§
- describe
- The script surface and the elements a descriptor’s
textdeclares, for the modulename, without looking at any file it names. - read_
web_ half - Read the web half of the module rooted at
root, declared in[dependencies]asname. - web_
half - The web half of the module rooted at
root: itsweb/directory, when that holds a descriptor.