tabler

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	PkgCore      = "@tabler/core"
	PkgIcons     = "@tabler/icons-sprite"
	PkgBootstrap = "bootstrap"
	PkgPopper    = "@popperjs/core"
)

Package names, as TABLER_VERSION records them.

View Source
const VersionFile = "TABLER_VERSION"

VersionFile is the single place the vendored versions are pinned.

Variables

View Source
var Registry = "https://registry.npmjs.org"

Registry is the npm registry. A var so a test can point it elsewhere.

Functions

func BundledBootstrap

func BundledBootstrap(js []byte) (string, error)

BundledBootstrap reads the Bootstrap version compiled into tabler.min.js.

func CoreLicenceURL

func CoreLicenceURL(version string) string

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 Manifest

func Manifest(files map[string][]byte) []byte

Manifest renders "sha256 path" lines, sorted, in sha256sum's format.

func Notices

func Notices(ls []Licence) []byte

Notices renders THIRD_PARTY_NOTICES.md from the licence texts.

func ReadIconList

func ReadIconList(data []byte) []string

ReadIconList reads icons.txt: one name per line, '#' comments.

func ReadTarball

func ReadTarball(data []byte) (map[string][]byte, error)

ReadTarball returns the regular files of a gzipped npm tarball, keyed by their path below the leading package/ directory.

func SubsetSprite

func SubsetSprite(sprite []byte, names []string) ([]byte, error)

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

func VerifyIntegrity(data []byte, integrity string) error

VerifyIntegrity checks data against an npm "sha512-<base64>" string.

Types

type Fetcher

type Fetcher interface {
	Get(url string) ([]byte, error)
}

Fetcher retrieves a URL's body.

type HTTPFetcher

type HTTPFetcher struct{}

HTTPFetcher fetches over the network.

func (HTTPFetcher) Get

func (HTTPFetcher) Get(u string) ([]byte, error)

type Licence

type Licence struct {
	File, Package, Version, What string
	Text                         []byte
}

Licence is one notice to carry.

func Licences

func Licences(vers Versions, texts map[string][]byte) []Licence

Licences pairs each vendored package with its licence text, keyed by the file name under LICENSES/. The order is the order THIRD_PARTY_NOTICES.md lists them in.

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.

func (*Vendor) Check

func (v *Vendor) Check() ([]string, error)

Check compares what TABLER_VERSION pins with the newest releases on npm and returns one line per package that is behind. It changes nothing: the weekly CI run prints the lines as warnings rather than opening a pull request.

func (*Vendor) Run

func (v *Vendor) Run(latest bool) error

Run vendors everything. With latest, it first resolves the newest releases and rewrites TABLER_VERSION.

type Versions

type Versions map[string]string

Versions is the parsed TABLER_VERSION file.

func ParseVersions

func ParseVersions(data []byte) (Versions, error)

ParseVersions reads "<package> <version>" lines; '#' starts a comment.

func (Versions) Format

func (v Versions) Format() []byte

Format renders the file. Order is fixed so a diff shows only what moved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL