pub

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 20 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 pub serves hosted Dart and Flutter package repositories to "dart pub" and "flutter pub" through the hosted pub repository spec v2.

A repository is a package server rooted at /repos/pub/{name}: the client's PUB_HOSTED_URL or the "hosted" url of a dependency. The package implements the package document (every version with its pubspec and archive checksum), the version document, the archive download, and "dart pub publish" (a three-step flow: the upload URL, the multipart archive upload, the finishing GET). Retraction, discontinuation, advisories and search are not served.

Index

Constants

View Source
const FormatName = "pub"

FormatName is the repository format name.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPHandler

type HTTPHandler struct {
	*base.Handler

	DB HTTPStore
}

HTTPHandler serves hosted pub repositories.

func NewHTTPHandler

func NewHTTPHandler(log *logger.Logger, db HTTPStore, blobStore storage.BlobStore, baseURL string) *HTTPHandler

NewHTTPHandler creates the handler.

func (*HTTPHandler) RegisterRepoRoutes

func (h *HTTPHandler) RegisterRepoRoutes(r chi.Router)

RegisterRepoRoutes registers the pub API on the /repos/pub/{name} subrouter. A request for a repository of another format is answered 404.

type HTTPStore

type HTTPStore interface {
	base.HandlerStore
	CreatePubPackage(ctx context.Context, c *models.PubPackage) error
	GetPubPackage(ctx context.Context, repoID string, name string, version string) (*models.PubPackage, error)
	ListPubVersions(ctx context.Context, repoID string, name string) ([]*models.PubPackage, error)
}

HTTPStore is the part of the database HTTPHandler needs.

Jump to

Keyboard shortcuts

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