bazelmodules

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package bazelmodules validates Bazel module registry uploads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveStripPrefix

func ArchiveStripPrefix(body io.ReadSeeker, size int64, name string) (string, error)

ArchiveStripPrefix returns a single enclosing directory shared by every regular archive entry, the layout Bazel's archive repository must strip. A flat or mixed archive is already rooted and needs no prefix.

func Integrity

func Integrity(hexDigest string) (string, error)

Integrity is Bazel's Subresource Integrity encoding of a stored SHA-256.

func ParseModule

func ParseModule(body []byte) (string, string, error)

ParseModule reads literal module name/version attributes. Dynamic module declarations and duplicate attributes are rejected because identity would otherwise depend on executing arbitrary Starlark at publication time.

func Serves

func Serves(t repo.PackageType) bool

func ValidName

func ValidName(name string) bool

ValidName and ValidVersion are deliberately narrower than arbitrary item names. An ambiguous registry path cannot become an upload or a fetch target.

func ValidVersion

func ValidVersion(version string) bool

Types

type File

type File struct{ Name, Version, Kind, ArchiveType string }

File identifies a native local publication file.

func ParseFile

func ParseFile(path string) (File, bool)

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) GuardWrite

func (Handler) GuardWrite(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) error

GuardWrite prevents two archives from claiming one module version. Bazel's source.json can name only one archive, so ambiguity must fail at upload.

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context,
	env format.Env,
	_ repo.Config,
	w format.Write,
) (any, error)

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

The native HTTP view is derived from current stored items. Reindex validates every publication rather than maintaining a second mutable metadata copy.

Jump to

Keyboard shortcuts

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