Skip to main content

Module addresses

Module addresses 

Source
Expand description

Content addresses: the one place an address devpage serves for a page to load is made.

Everything a page loads from devpage itself — a built-in asset, a system widget, a project widget or a helper it imports — is named by address, and by nothing else. The page’s tags, the import map, the widget list, the import inside a compiled widget, and the server’s answer to “is this address current?” all come from it, so two of them never differ by a byte: a browser that preloads one address and imports another downloads twice.

Every address but a built-in asset’s is the document’s: it starts with the served folder’s mount, so a version in server mode, under /d/<id>/v/<n>, asks its own router. A built-in asset is the same for every document.

An address changes exactly when the bytes it serves would: a built-in asset’s carries the hash of its bytes (/__devpage/devpage.<hash>.js); a widget’s carries ?v=<hash> over what its compiled module is made from. What answers a current address never changes, so it is served immutable; any other — a bare name, a stale hash — still answers, with the current bytes and no-cache.

Structs§

Asset
A built-in asset, as build.rs made it.

Enums§

Owned
Something a page loads from devpage itself.

Constants§

BUILD
devpage’s build id: a hash of everything the binary is built from.

Statics§

ASSETS
The built-in assets, each under its content address.

Functions§

address
The address owned is served at, for a page to load: the only function that makes one.
asset
The built-in asset a name under /__devpage/ asks for, and whether it is its current content address. A bare name (devpage.js) and a stale hash (devpage.0123456789abcdef.js) find the asset, but not as current.
hash
The first 16 hex digits of the SHA-256 of bytes.
short
The first 16 hex digits of a digest: what every address and validator carries.
system_widget_hash
A system widget’s version: its source, the names it can render and the build. None for a name that isn’t a system widget.