vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • Reference
  • Classes
  • PackageInfoClient
  • Type Aliases
  • Capabilities
  • ExtractResolution
  • PackageInfoClientExtractOptions
  • PackageInfoClientOptions
  • PackageInfoClientRequestOptions
  • Resolution
  • ResolveRequest
  • Variables
  • delimiter
  • PACKUMENT_ACCEPT
  • VLT_PACKUMENT_MIME
  • VLT_PACKUMENT_V2_MIME
  • Functions
  • getCapabilities()
  • peekCapabilities()
  • resetCapabilities()
  1. Client
  2. /
  3. API Reference
  4. /
  5. @vltpkg/package-info
  6. /
  7. Reference

Reference

Classes

PackageInfoClient

Defined in: package-info/src/index.ts:309

Constructors

new PackageInfoClient()
TypeScript
new PackageInfoClient(options): PackageInfoClient

Defined in: package-info/src/index.ts:501

Parameters
ParameterType
optionsPackageInfoClientOptions
Returns

PackageInfoClient

Properties

PropertyType
monorepo?Monorepo
optionsPackageInfoClientOptions
packageJsonPackageJson

Accessors

resolvedManifestCount
Get Signature
TypeScript
get resolvedManifestCount(): number

Defined in: package-info/src/index.ts:1447

How many manifests resolve batches have delivered. For tests.

Returns

number

Methods

_manifestCachePath()
TypeScript
_manifestCachePath(spec, options): undefined | string

Defined in: package-info/src/index.ts:1010

Conditionally return the path to the manifest cache file. The logic to determine if caching should be skipped aligns with pickManifest and is used to avoid caching manifest results that can be variable.

Parameters
ParameterType
specSpec
optionsPackageInfoClientRequestOptions
Returns

undefined | string

capabilities()
TypeScript
capabilities(registry): Promise<Capabilities>

Defined in: package-info/src/index.ts:444

The vlt extensions registry serves, from its GET /-/vlt/capabilities document. A registry that does not answer one reads as an empty document, so a missing key means unsupported.

Parameters
ParameterType
registrystring
Returns

Promise<Capabilities>

drain()
TypeScript
drain(): Promise<void>

Defined in: package-info/src/index.ts:413

Wind the client down: abort open resolve streams, settle background work (manifest cache writes, capabilities, hedges), drain the registry client (in-flight requests, cache writes). Await before removing the cache dir or exiting.

Returns

Promise<void>

extract()
TypeScript
extract(
   spec, 
   target, 
options): Promise<ExtractResolution>

Defined in: package-info/src/index.ts:524

Parameters
ParameterType
specstring | Spec
targetstring
optionsPackageInfoClientExtractOptions
Returns

Promise<ExtractResolution>

getRegistryClient()
TypeScript
getRegistryClient(): Promise<RegistryClient>

Defined in: package-info/src/index.ts:429

Returns

Promise<RegistryClient>

getTarPool()
TypeScript
getTarPool(): Promise<Pool>

Defined in: package-info/src/index.ts:474

Returns

Promise<Pool>

manifest()
TypeScript
manifest(spec, options): Promise<
  | Manifest
| Override<Manifest, NormalizedFields>>

Defined in: package-info/src/index.ts:1451

Parameters
ParameterType
specstring | Spec
optionsPackageInfoClientRequestOptions
Returns

Promise< | Manifest | Override<Manifest, NormalizedFields>>

packument()
TypeScript
packument(spec, options): Promise<Packument>

Defined in: package-info/src/index.ts:1657

The packument for spec, with every version the registry has. Callers that only pick a manifest out of it go through #packument instead, which can ask for the prerelease-free one.

Parameters
ParameterType
specstring | Spec
optionsPackageInfoClientRequestOptions
Returns

Promise<Packument>

prefetchResolve()
TypeScript
prefetchResolve(registry, request): () => void

Defined in: package-info/src/index.ts:1259

Start a server-side resolve for request against registry and return without waiting. manifest() answers from what has arrived, and blocks on the request only when it needs a key that has not.

A no-op unless the registry says it serves the endpoint. Anything it does not deliver is left to manifest().

Returns the function that releases the request. A build calls it once it has placed its last node; when the last build reading a request has released it, the stream is ended, so an install never waits on a stream nothing will read. The records it delivered stay answerable.

Parameters
ParameterType
registrystring
requestResolveRequest
Returns

Function

Returns

void

resolve()
TypeScript
resolve(spec, options): Promise<Resolution>

Defined in: package-info/src/index.ts:1840

Parameters
ParameterType
specstring | Spec
optionsPackageInfoClientRequestOptions
Returns

Promise<Resolution>

tarball()
TypeScript
tarball(spec, options): Promise<Buffer<ArrayBufferLike>>

Defined in: package-info/src/index.ts:1056

Parameters
ParameterType
specstring | Spec
optionsPackageInfoClientExtractOptions
Returns

Promise<Buffer<ArrayBufferLike>>

Type Aliases

Capabilities

TypeScript
type Capabilities = object;

Defined in: package-info/src/capabilities.ts:8

What GET /-/vlt/capabilities answers: the vlt extensions a registry serves. Every field is optional — a registry that has never heard of the document, or that is down when it is asked, reads as an empty one.

Type declaration

NameTypeDescription
manifests?stringcontract version of /-/vlt/manifests, the batch manifest endpoint
mimeTypes?string[]packument media types the registry serves, most preferred first
resolve?stringcontract version of /-/vlt/resolve, server-side range resolution
stable-filter?stringcontract version of the ?stable packument filter

ExtractResolution

TypeScript
type ExtractResolution = Resolution & object;

Defined in: package-info/src/index.ts:124

PackageInfoClient.extract result. A global store link also carries what its index knows, so reify need not read it from disk.

Type declaration

NameTypeDescription
bindingGyp?booleantrue if the package has a root binding.gyp
manifest?stringthe package.json as JSON text, if the index has it

PackageInfoClientExtractOptions

TypeScript
type PackageInfoClientExtractOptions = PackageInfoClientRequestOptions & object;

Defined in: package-info/src/index.ts:205

Type declaration

NameTypeDescription
fromLockfile?booleanWhen true, indicates that integrity + resolved came from a lockfile (i.e. they were already verified on first install). Skips re-hashing a refetched body of an already verified url. Other network bodies are always checked.
integrity?Integrity-
resolved?string-

PackageInfoClientOptions

TypeScript
type PackageInfoClientOptions = RegistryClientOptions & SpecOptions & object;

Defined in: package-info/src/index.ts:131

Type declaration

NameTypeDescription
brotli-tarballs?booleanResolve to the registry's Brotli (.tar.br) tarball when it advertises one in dist.alternates. Defaults to true; set false to always resolve to the gzip .tgz.
monorepo?Monorepo-
packageJson?PackageJsonPackageJson object
projectRoot?stringroot of the project. Defaults to process.cwd()
store-linker?StoreLinkerHow registry packages are placed: unpack (default) unpacks the tarball, anything else goes through the global store first.
workspace?string[]workspace paths to load, irrelevant if Monorepo provided
workspace-group?string[]workspace groups to load, irrelevant if Monorepo provided

PackageInfoClientRequestOptions

TypeScript
type PackageInfoClientRequestOptions = PickManifestOptions & RegistryClientRequestOptions & object;

Defined in: package-info/src/index.ts:160

Type declaration

NameTypeDescription
backgroundRevalidate?booleanA moving selector whose packument is still within max-age is served from it and revalidated after exit, not before use. Pinned specs are unaffected.
from?stringdir to resolve file:// specifiers against. Defaults to projectRoot.
full?booleanFetch the full packument (readme, maintainers, dist.integrity) rather than the abbreviated one. Bypasses the disk cache, which is keyed by URL alone, so the two representations never mix.

Resolution

TypeScript
type Resolution = object;

Defined in: package-info/src/index.ts:108

Type declaration

NameTypeDescription
digestRequired?booleanThe manifest came from a vlt packument, which carries no dist.integrity: the tarball response must carry a Repr-Digest.
integrity?Integrity-
resolvedstring-
signatures?Exclude<Manifest["dist"], undefined>["signatures"]-
specSpec-

ResolveRequest

TypeScript
type ResolveRequest = object;

Defined in: package-info/src/resolve-batch.ts:21

The request body /-/vlt/resolve takes.

Type declaration

NameType
closure?boolean
have?string[]
platform?object
platform.cpu?string
platform.libc?string
platform.node?string
platform.os?string
rootsobject[]
stop?object
stop.names?string[]
stop.scopes?string[]
tag?string

Variables

delimiter

TypeScript
const delimiter: "~" = '~';

Defined in: package-info/src/index.ts:74


PACKUMENT_ACCEPT

TypeScript
const PACKUMENT_ACCEPT: "application/vnd.vlt.packument-v2+json; q=1.0, application/vnd.vlt.packument-v1+json; q=0.9, application/json; q=0.8, */*; q=0.1";

Defined in: package-info/src/index.ts:106

Accept header for packument requests. Prefers vlt's abbreviated packument, v2 over v1, and falls back to the full one on registries that know neither. See PackageInfoClient.#fetchPackument.

The trailing wildcard range carries an explicit q=0.1 so that it stays below application/json. A media range with no q defaults to q=1.0 (RFC 9110 12.5.1), which on a registry that negotiates strictly by quality would let an unrelated representation — npm's corgi among them — outrank the full packument and drop license. The wildcard is kept only so a registry that rejects what it cannot satisfy exactly still has something to match.


VLT_PACKUMENT_MIME

TypeScript
const VLT_PACKUMENT_MIME: "application/vnd.vlt.packument-v1+json" = 'application/vnd.vlt.packument-v1+json';

Defined in: package-info/src/index.ts:82

vlt's abbreviated packument: corgi plus the fields the graph relies on (license, time, hasInstallScript), minus dist.integrity (the tarball response carries a Repr-Digest instead) and with dist.tarball relative to the registry base.


VLT_PACKUMENT_V2_MIME

TypeScript
const VLT_PACKUMENT_V2_MIME: "application/vnd.vlt.packument-v2+json" = 'application/vnd.vlt.packument-v2+json';

Defined in: package-info/src/index.ts:90

VLT_PACKUMENT_MIME with each dist.tarball reduced to the tarball's basename (foo-1.0.0.tgz), which resolves against the package's {registry}{name}/-/ directory.

Functions

getCapabilities()

TypeScript
function getCapabilities(client, registry): Promise<Capabilities>

Defined in: package-info/src/capabilities.ts:64

The vlt extensions registry serves. Anything short of a capability document — a registry that 404s it, a request that fails, a body that does not parse — answers an empty one, so a caller that reads a missing key as unsupported treats those registries as plain npm registries.

Parameters

ParameterType
clientRegistryClient
registrystring

Returns

Promise<Capabilities>


peekCapabilities()

TypeScript
function peekCapabilities(client, registry): undefined | Capabilities

Defined in: package-info/src/capabilities.ts:47

What registry answered, if it has answered already, and undefined while the question is still open. Asking starts the request when nothing has asked yet, so a caller can peek now and get an answer on a later call without ever waiting for one.

Parameters

ParameterType
clientRegistryClient
registrystring

Returns

undefined | Capabilities


resetCapabilities()

TypeScript
function resetCapabilities(): void

Defined in: package-info/src/capabilities.ts:36

Forget every registry that has been asked. Exposed for tests.

Returns

void


Previous@vltpkg/package-infoNext@vltpkg/package-json

On this page

  • Classes
  • PackageInfoClient
  • Type Aliases
  • Capabilities
  • ExtractResolution
  • PackageInfoClientExtractOptions
  • PackageInfoClientOptions
  • PackageInfoClientRequestOptions
  • Resolution
  • ResolveRequest
  • Variables
  • delimiter
  • PACKUMENT_ACCEPT
  • VLT_PACKUMENT_MIME
  • VLT_PACKUMENT_V2_MIME
  • Functions
  • getCapabilities()
  • peekCapabilities()
  • resetCapabilities()

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now