Reference
Classes
PackageInfoClient
Defined in: package-info/src/index.ts:210
Constructors
new PackageInfoClient()
new PackageInfoClient(options): PackageInfoClientDefined in: package-info/src/index.ts:317
Parameters
| Parameter | Type |
|---|---|
options | PackageInfoClientOptions |
Returns
Properties
| Property | Type |
|---|---|
monorepo? | Monorepo |
options | PackageInfoClientOptions |
packageJson | PackageJson |
Methods
_manifestCachePath()
_manifestCachePath(spec, options): undefined | stringDefined 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
| Parameter | Type |
|---|---|
spec | Spec |
options | PackageInfoClientRequestOptions |
Returns
undefined | string
capabilities()
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
| Parameter | Type |
|---|---|
registry | string |
Returns
Promise<Capabilities>
extract()
extract(
spec,
target,
options): Promise<ExtractResolution>Defined in: package-info/src/index.ts:344
Parameters
| Parameter | Type |
|---|---|
spec | string | Spec |
target | string |
options | PackageInfoClientExtractOptions |
Returns
Promise<ExtractResolution>
getRegistryClient()
getRegistryClient(): Promise<RegistryClient>Defined in: package-info/src/index.ts:261
Returns
Promise<RegistryClient>
getTarPool()
getTarPool(): Promise<Pool>Defined in: package-info/src/index.ts:306
Returns
Promise<Pool>
manifest()
manifest(spec, options): Promise<
| Manifest
| Override<Manifest, NormalizedFields>>Defined in: package-info/src/index.ts:960
Parameters
| Parameter | Type |
|---|---|
spec | string | Spec |
options | PackageInfoClientRequestOptions |
Returns
Promise<
| Manifest
| Override<Manifest, NormalizedFields>>
packument()
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
| Parameter | Type |
|---|---|
spec | string | Spec |
options | PackageInfoClientRequestOptions |
Returns
Promise<Packument>
resolve()
resolve(spec, options): Promise<Resolution>Defined in: package-info/src/index.ts:1314
Parameters
| Parameter | Type |
|---|---|
spec | string | Spec |
options | PackageInfoClientRequestOptions |
Returns
Promise<Resolution>
tarball()
tarball(spec, options): Promise<Buffer<ArrayBufferLike>>Defined in: package-info/src/index.ts:768
Parameters
| Parameter | Type |
|---|---|
spec | string | Spec |
options | PackageInfoClientExtractOptions |
Returns
Promise<Buffer<ArrayBufferLike>>
Type Aliases
Capabilities
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
| Name | Type | Description |
|---|---|---|
manifests? | string | contract version of /-/vlt/manifests, the batch manifest endpoint |
mimeTypes? | string[] | packument media types the registry serves, most preferred first |
resolve? | string | contract version of /-/vlt/resolve, server-side range resolution |
stable-filter? | string | contract version of the ?stable packument filter |
ExtractResolution
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
| Name | Type | Description |
|---|---|---|
bindingGyp? | boolean | true if the package has a root binding.gyp |
manifest? | string | the package.json as JSON text, if the index has it |
PackageInfoClientExtractOptions
type PackageInfoClientExtractOptions = PackageInfoClientRequestOptions & object;Defined in: package-info/src/index.ts:143
Type declaration
| Name | Type | Description |
|---|---|---|
fromLockfile? | boolean | When 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? | boolean | The 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
type PackageInfoClientOptions = RegistryClientOptions & SpecOptions & object;Defined in: package-info/src/index.ts:109
Type declaration
| Name | Type | Description |
|---|---|---|
monorepo? | Monorepo | - |
packageJson? | PackageJson | PackageJson object |
projectRoot? | string | root of the project. Defaults to process.cwd() |
store-linker? | StoreLinker | How 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
type PackageInfoClientRequestOptions = PickManifestOptions & RegistryClientRequestOptions & object;Defined in: package-info/src/index.ts:131
Type declaration
| Name | Type | Description |
|---|---|---|
from? | string | dir to resolve file:// specifiers against. Defaults to projectRoot. |
full? | boolean | Fetch 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
type Resolution = object;Defined in: package-info/src/index.ts:86
Type declaration
Variables
delimiter
const delimiter: "~" = '~';Defined in: package-info/src/index.ts:60
PACKUMENT_ACCEPT
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
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()
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
| Parameter | Type |
|---|---|
client | RegistryClient |
registry | string |
Returns
Promise<Capabilities>
peekCapabilities()
function peekCapabilities(client, registry): undefined | CapabilitiesDefined 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
| Parameter | Type |
|---|---|
client | RegistryClient |
registry | string |
Returns
undefined | Capabilities
resetCapabilities()
function resetCapabilities(): voidDefined in: package-info/src/capabilities.ts:36
Forget every registry that has been asked. Exposed for tests.
Returns
void