Expand description
compmd-pack: the names CompMD packs and their files are known by (spec §6.4), each
checked once, when it is made, so a name that could leave a folder, or isn’t a pack’s, can’t exist.
The processor (compmd, which re-exports this crate as compmd::pack) and every host’s code (compmd-host) use
the same types, so a pack’s name, a release and a file’s place mean one thing everywhere.
use compmd_pack::{Integrity, PackName, Place};
let place: Place = "@kit/mermaid@1.2.0/dist/mermaid.js".parse()?;
assert_eq!(place.release.pack, "@kit/mermaid".parse::<PackName>()?);
assert_eq!(place.release.to_string(), "@kit/mermaid@1.2.0");
assert_eq!(place.path.as_str(), "dist/mermaid.js");
let integrity: Integrity = "sha512-9c1fQe0=".parse()?;
assert_eq!(integrity.to_string(), "sha512-9c1fQe0=");Structs§
- File
Path - A file’s path in a pack,
dist/mermaid.js. - Integrity
- An integrity,
sha512-9c1fQe…. In JSON it is that string. - Pack
Name - A pack’s name,
@scope/name. - Place
- A file of a pack, by its place. In JSON it is
{"pack": …, "version": …, "path": …}. - Release
Id - A pack at one version. In JSON it is
{"pack": "@kit/mermaid", "version": "1.2.0"}.
Enums§
- Algorithm
- A hash’s algorithm.
- Invalid
- What is wrong with a text read as a pack’s name, a release, a path, a place or an integrity.
Functions§
- newest_
matching - The newest of
versionsthatrangetakes, as the processor reads the version or range after a pack’s name in an import’sfrom(spec §6.1):1.4.2is exactly that version,1and^1.4ranges,*any.Nonewhen none matches, orrangeisn’t one. A host that fetches the packs a document needs picks a version with this, so the processor takes the release it was given. - range
- The range
textis, and whether it is one exact version:1.4.2is exactly that release, unlike Cargo’s requirements, where it would be^1.4.2.Nonewhen it isn’t a range.