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
  • Variables
  • delimiter
  • PACKUMENT_ACCEPT
  • VLT_PACKUMENT_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:210

Constructors

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

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

Parameters
ParameterType
optionsPackageInfoClientOptions
Returns

PackageInfoClient

Properties

PropertyType
monorepo?Monorepo
optionsPackageInfoClientOptions
packageJsonPackageJson

Methods

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

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

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:276

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>

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

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

Parameters
ParameterType
specstring | Spec
targetstring
optionsPackageInfoClientExtractOptions
Returns

Promise<ExtractResolution>

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

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

Returns

Promise<RegistryClient>

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

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

Returns

Promise<Pool>

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

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

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:1141

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>

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

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

Parameters
ParameterType
specstring | Spec
optionsPackageInfoClientRequestOptions
Returns

Promise<Resolution>

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

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

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:102

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:143

Type declaration

NameTypeDescription
fromLockfile?booleanWhen true, indicates that integrity + resolved came from a lockfile (i.e. they were already verified on first install). Skips the client-side tarball integrity check. Defaults to false — fresh installs always verify integrity.
installScripts?booleanThe manifest declares install scripts: copy the package from the global store, never link it, even if its package.json has none.
integrity?Integrity-
resolved?string-

PackageInfoClientOptions

TypeScript
type PackageInfoClientOptions = RegistryClientOptions & SpecOptions & object;

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

Type declaration

NameTypeDescription
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:131

Type declaration

NameTypeDescription
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:86

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-

Variables

delimiter

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

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


PACKUMENT_ACCEPT

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

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

Accept header for packument requests. Prefers vlt's abbreviated packument and falls back to the full one on registries that do not know the type. 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:68

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.

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
  • Variables
  • delimiter
  • PACKUMENT_ACCEPT
  • VLT_PACKUMENT_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