Documentation
¶
Overview ¶
Package tabler vendors the Tabler assets the web UI embeds: it resolves and pins versions, downloads and integrity-checks the npm tarballs, cuts the icon subset, and writes the licence texts, the hash manifest and the repository's third-party-notices.md. The tablervendor command drives it; the web package's tests use it to check the committed files still agree.
Index ¶
- Constants
- Variables
- func BundledBootstrap(js []byte) (string, error)
- func CoreLicenceURL(version string) string
- func Manifest(files map[string][]byte) []byte
- func Notices(ls []Licence) []byte
- func ReadIconList(data []byte) []string
- func ReadTarball(data []byte) (map[string][]byte, error)
- func SubsetSprite(sprite []byte, names []string) ([]byte, error)
- func VerifyIntegrity(data []byte, integrity string) error
- type Fetcher
- type HTTPFetcher
- type Licence
- type Vendor
- type Versions
Constants ¶
const ( PkgCore = "@tabler/core" PkgIcons = "@tabler/icons-sprite" PkgBootstrap = "bootstrap" PkgPopper = "@popperjs/core" )
Package names, as TABLER_VERSION records them.
const VersionFile = "TABLER_VERSION"
VersionFile is the single place the vendored versions are pinned.
Variables ¶
var Registry = "https://registry.npmjs.org"
Registry is the npm registry. A var so a test can point it elsewhere.
Functions ¶
func BundledBootstrap ¶
BundledBootstrap reads the Bootstrap version compiled into tabler.min.js.
func CoreLicenceURL ¶
CoreLicenceURL is @tabler/core's LICENSE at the release tag. The npm tarball ships none, so it comes from the repository; since 1.3 the tags are named "@tabler/core@<version>", which is what this escapes.
func ReadIconList ¶
ReadIconList reads icons.txt: one name per line, '#' comments.
func ReadTarball ¶
ReadTarball returns the regular files of a gzipped npm tarball, keyed by their path below the leading package/ directory.
func SubsetSprite ¶
SubsetSprite returns an SVG holding only the named symbols, in the order asked. A missing name is an error: the UI would render a blank icon.
func VerifyIntegrity ¶
VerifyIntegrity checks data against an npm "sha512-<base64>" string.
Types ¶
type Vendor ¶
type Vendor struct {
Root string // repository root
AssetDir string // src/internal/web/assets/vendor
Fetch Fetcher
Log func(format string, a ...any)
}
Vendor writes the vendored tree.
type Versions ¶
Versions is the parsed TABLER_VERSION file.
func ParseVersions ¶
ParseVersions reads "<package> <version>" lines; '#' starts a comment.