Skip to main content

Module generate

Module generate 

Source
Expand description

The build-time static-asset pipeline.

Hashing happens here, at build time, rather than when the server starts. That ordering is the whole point:

  • It is idempotent by construction. Renaming files at startup was not: a second run hashed the already-hashed names, the manifest keys stopped being the logical paths, and every stylesheet, script and image 404’d. An in-place docker restart was enough to trigger it.
  • The server never writes to disk, so a production image needs no writable filesystem and two replicas cannot race over a shared volume.
  • One hashing pass serves both consumers. The manifest feeds the templates; the generated TypeScript module feeds the browser. They cannot disagree, because they are two views of the same operation.

It runs in two phases because the JavaScript contents depend on the manifest, while the JavaScript files must be hashed once they exist. Scripts never need their own hash — the layout takes that from the manifest.

Enums§

Phase
Which half of the pipeline to run.

Constants§

FAVICON_DIRECTORY
Where the icon set lives.
FAVICON_PNG_SOURCE
The raster icon source, for art that cannot be vectorised — a photograph, most obviously.
FAVICON_SVG_SOURCE
The vector icon source, preferred when the art allows it.
STATIC_DIRECTORY
The directory every project keeps its static assets in.

Functions§

generate_static_assets
Runs one phase of the pipeline.