Skip to main content

deployed_assets

Function deployed_assets 

Source
pub fn deployed_assets(
    context: &str,
    unit_uses: &HashMap<String, Vec<String>>,
    unit_consumes: &HashMap<String, Vec<String>>,
    unit_tables: &HashMap<String, UnitTable>,
    served: &BTreeMap<String, String>,
) -> BTreeMap<String, String>
Expand description

The files a context’s Worker ships, keyed by served path, each mapped to its normalised source path. Sorted and deduplicated by served path, so the output is reproducible.

  • Content-hashed assets come from every unit the context reaches over uses and consumes, transitively. Through uses, a commons may return another commons’ .url; through consumes, another context may return one of its own in a fragment this Worker serves (#1883, slice 2). Either way the URL resolves against this Worker, so it ships the file. Hashed names never collide, so the duplication costs only bytes.
  • Fixed-path assets (at "/favicon.ico") come over uses only: they belong to the root of the Worker that declares them, and shipping a consumed context’s fixed paths would collide with this one’s own.