@vltpkg/spec
Classes
Spec
Defined in: spec/src/index.ts:17
The base, isomorphic Spec implementation.
Extends
Implements
Constructors
new Spec()
new Spec( name, bareSpec, options?): SpecDefined in: spec/src/browser.ts:299
The initial value of Object.prototype.constructor is the standard built-in Object constructor.
Parameters
name
string
bareSpec
string
options?
Returns
Inherited from
new Spec()
new Spec(spec, options?): SpecDefined in: spec/src/browser.ts:300
The initial value of Object.prototype.constructor is the standard built-in Object constructor.
Parameters
spec
string
options?
Returns
Inherited from
new Spec()
new Spec( spec, bareOrOptions?, options?): SpecDefined in: spec/src/browser.ts:301
The initial value of Object.prototype.constructor is the standard built-in Object constructor.
Parameters
spec
string | Spec
bareOrOptions?
string | SpecOptions
options?
Returns
Inherited from
Properties
bareSpec
bareSpec: stringDefined in: spec/src/browser.ts:238
just the part AFTER the name, so 1.x in [email protected]
Implementation of
SpecLike.bareSpecInherited from
catalog?
optional catalog: string;Defined in: spec/src/browser.ts:257
Inherited from
constructor
constructor: typeof SpecDefined in: spec/src/browser.ts:297
The initial value of Object.prototype.constructor is the standard built-in Object constructor.
Inherited from
BrowserSpec.constructorconventionalRegistryTarball?
optional conventionalRegistryTarball: string;Defined in: spec/src/browser.ts:251
conventional location of the tarball on the registry, if it can be guessed. This is only attempted if the spec is a registry type, with a single version comparator. This can be used to elide resolved urls that are repetitive and predictable.
Implementation of
SpecLike.conventionalRegistryTarballInherited from
Spec.conventionalRegistryTarball
distTag?
optional distTag: string;Defined in: spec/src/browser.ts:254
a dist-tag like ‘latest’
Implementation of
SpecLike.distTagInherited from
file?
optional file: string;Defined in: spec/src/browser.ts:256
file path for file:// url specs
Implementation of
SpecLike.fileInherited from
gitCommittish?
optional gitCommittish: string;Defined in: spec/src/browser.ts:242
the commit value we will check out
Implementation of
SpecLike.gitCommittishInherited from
gitRemote?
optional gitRemote: string;Defined in: spec/src/browser.ts:239
the git remote to fetch from
Implementation of
SpecLike.gitRemoteInherited from
gitSelector?
optional gitSelector: string;Defined in: spec/src/browser.ts:240
the committish, semver range, and/or path portion of a git remote
Implementation of
SpecLike.gitSelectorInherited from
gitSelectorParsed?
optional gitSelectorParsed: GitSelectorParsed;Defined in: spec/src/browser.ts:241
the parsed ’::‘-separated key/value pairs: semver:<range> and
path:<subpath>
Implementation of
SpecLike.gitSelectorParsedInherited from
name
name: stringDefined in: spec/src/browser.ts:235
the name portion, so foo in [email protected]
Implementation of
SpecLike.nameInherited from
namedGitHost?
optional namedGitHost: string;Defined in: spec/src/browser.ts:243
github, gitlab, bitbucket, gist, etc.
Implementation of
SpecLike.namedGitHostInherited from
namedGitHostPath?
optional namedGitHostPath: string;Defined in: spec/src/browser.ts:244
the path that’s parsed when we have a named git host
Implementation of
SpecLike.namedGitHostPathInherited from
namedJsrRegistry?
optional namedJsrRegistry: string;Defined in: spec/src/browser.ts:248
Inherited from
namedRegistry?
optional namedRegistry: string;Defined in: spec/src/browser.ts:247
In specs like foo@npm:bar@1, this is the ‘npm’ part. Other
registries can be mapped using the registries option.
Implementation of
SpecLike.namedRegistryInherited from
options
options: SpecOptionsFilledDefined in: spec/src/browser.ts:234
options passed to the constructor, plus defaults
Implementation of
SpecLike.optionsInherited from
overridden
overridden: boolean = falseDefined in: spec/src/browser.ts:259
Is this a spec that overrides another spec?
Implementation of
SpecLike.overriddenInherited from
range?
optional range: Range;Defined in: spec/src/browser.ts:253
parsed semver range specifier
Implementation of
SpecLike.rangeInherited from
registry?
optional registry: string;Defined in: spec/src/browser.ts:249
registry to consult to resolve this spec
Implementation of
SpecLike.registryInherited from
registrySpec?
optional registrySpec: string;Defined in: spec/src/browser.ts:250
semver range or dist-tag for resolving against a packument
Implementation of
SpecLike.registrySpecInherited from
remoteURL?
optional remoteURL: string;Defined in: spec/src/browser.ts:255
URL to download a tarball from, if it can be determined.
This is set for url specs of course, but also git remotes on known hosts that provide a gitHostArchive template.
Implementation of
SpecLike.remoteURLInherited from
scope?
optional scope: `@${string}`;Defined in: spec/src/browser.ts:236
the name’s scope, so @acme in @acme/[email protected]
Implementation of
SpecLike.scopeInherited from
scopeRegistry?
optional scopeRegistry: string;Defined in: spec/src/browser.ts:237
if the name is scoped, and there’s a registry associated with the scope, then this is that registry
Implementation of
SpecLike.scopeRegistryInherited from
semver?
optional semver: string;Defined in: spec/src/browser.ts:252
spec to resolve against available versions
Implementation of
SpecLike.semverInherited from
spec
spec: stringDefined in: spec/src/browser.ts:233
the full named specifier passed to the constructor
Implementation of
SpecLike.specInherited from
subspec?
optional subspec: Spec;Defined in: spec/src/browser.ts:258
in bar@npm:[email protected], this is the spec for [email protected]
Implementation of
SpecLike.subspecInherited from
type
type: SpecTypeDefined in: spec/src/browser.ts:232
the type of spec that this is, ultimately
Implementation of
SpecLike.typeInherited from
workspace?
optional workspace: string;Defined in: spec/src/browser.ts:246
the package name or path of the workspace being referenced
Implementation of
SpecLike.workspaceInherited from
workspaceSpec?
optional workspaceSpec: string;Defined in: spec/src/browser.ts:245
the specifier when using workspace: specs This can be either a
semver range, *, ~, or ^, if the name is not modified. Or, it
can include a workspace package name or path, like
workspace:packages/foo@* or workspace:@scope/foo@*.
Implementation of
SpecLike.workspaceSpecInherited from
nodejsDependencies?
static optional nodejsDependencies: NodeJSDependenciesOptions;Defined in: spec/src/browser.ts:230
Inherited from
Accessors
final
Get Signature
get final(): Spec & objectDefined in: spec/src/browser.ts:268
Return the final entry in the chain of subspecs When deciding which thing to actually fetch, spec.final is the thing to look at.
Returns
Spec & object
Implementation of
SpecLike.finalInherited from
inheritedRegistry
Set Signature
set inheritedRegistry(reg): voidDefined in: spec/src/browser.ts:771
Sets a registry value that should be used for this spec in case it is currently just following the default registry.
Parameters
reg
undefined | string
Returns
void
Implementation of
SpecLike.inheritedRegistryInherited from
Methods
[kCustomInspect]()
kCustomInspect: stringDefined in: spec/src/index.ts:18
Parameters
_depth?
number
options?
InspectOptions
Returns
string
Overrides
toString()
toString(): stringDefined in: spec/src/browser.ts:287
Normally, the string value of a Spec is just the string passed in to
be parsed. However, in the case of a chain of subspecs, like
foo@npm:bar@npm:baz@npm:quux@latest, this simplifies out the middle
parts of the chain, returning just foo@npm:quux@latest
Returns
string
Implementation of
SpecLike.toStringInherited from
parse()
Call Signature
static parse( name, bareSpec, options?): SpecDefined in: spec/src/browser.ts:178
Create a Spec object from a full spec, name+bareSpec, or Spec object
Note: If a Spec object is provided, it is returned as-is, without investigating whether the options match.
Parameters
name
string
bareSpec
string
options?
Returns
Inherited from
Call Signature
static parse(spec, options?): SpecDefined in: spec/src/browser.ts:183
Create a Spec object from a full spec, name+bareSpec, or Spec object
Note: If a Spec object is provided, it is returned as-is, without investigating whether the options match.
Parameters
spec
string
options?
Returns
Inherited from
Call Signature
static parse(spec, options?): SpecDefined in: spec/src/browser.ts:184
Create a Spec object from a full spec, name+bareSpec, or Spec object
Note: If a Spec object is provided, it is returned as-is, without investigating whether the options match.
Parameters
spec
options?
Returns
Inherited from
parseArgs()
static parseArgs(specOrBareSpec, opts?): SpecDefined in: spec/src/browser.ts:195
Parameters
specOrBareSpec
string
opts?
Returns
Inherited from
parseGitSelector()
static parseGitSelector(selector, spec?): [GitSelectorParsed, string, Range]Defined in: spec/src/browser.ts:785
Should only ever be called with the bit that comes AFTER the # in the git remote url.
Parameters
selector
string
spec?
Returns
[GitSelectorParsed, string,
Range]
Inherited from
Type Aliases
GitSelectorParsed
type GitSelectorParsed = objectDefined in: spec/src/types.ts:26
Type declaration
path?
optional path: string;semver?
optional semver: string;Scope
type Scope = `@${string}`Defined in: spec/src/types.ts:7
SpecLike<Type>
type SpecLike<Type> = SpecLikeBase & objectDefined in: spec/src/types.ts:150
Type declaration
final
final: Typesubspec?
optional subspec: Type;Type Parameters
• Type extends SpecLikeBase
SpecLikeBase
type SpecLikeBase = objectDefined in: spec/src/types.ts:39
Type declaration
bareSpec
bareSpec: stringjust the part AFTER the name, so 1.x in [email protected]
conventionalRegistryTarball?
optional conventionalRegistryTarball: string;conventional location of the tarball on the registry, if it can be guessed. This is only attempted if the spec is a registry type, with a single version comparator. This can be used to elide resolved urls that are repetitive and predictable.
distTag?
optional distTag: string;a dist-tag like ‘latest’
file?
optional file: string;file path for file:// url specs
final
final: SpecLikeBasegetter that retrieves the actual spec value to be used
gitCommittish?
optional gitCommittish: string;the commit value we will check out
gitRemote?
optional gitRemote: string;the git remote to fetch from
gitSelector?
optional gitSelector: string;the committish, semver range, and/or path portion of a git remote
gitSelectorParsed?
optional gitSelectorParsed: GitSelectorParsed;the parsed ’::‘-separated key/value pairs: semver:<range> and
path:<subpath>
name
name: stringthe name portion, so foo in [email protected]
namedGitHost?
optional namedGitHost: string;github, gitlab, bitbucket, gist, etc.
namedGitHostPath?
optional namedGitHostPath: string;the path that’s parsed when we have a named git host
namedRegistry?
optional namedRegistry: string;In specs like foo@npm:bar@1, this is the ‘npm’ part. Other
registries can be mapped using the registries option.
options
options: SpecOptionsFilledoptions passed to the constructor, plus defaults
overridden
overridden: booleanIs this a spec that overrides another spec?
range?
optional range: Range;parsed semver range specifier
registry?
optional registry: string;registry to consult to resolve this spec
registrySpec?
optional registrySpec: string;semver range or dist-tag for resolving against a packument
remoteURL?
optional remoteURL: string;URL to download a tarball from, if it can be determined.
This is set for url specs of course, but also git remotes on known hosts that provide a gitHostArchive template.
scope?
optional scope: Scope;the name’s scope, so @acme in @acme/[email protected]
scopeRegistry?
optional scopeRegistry: string;if the name is scoped, and there’s a registry associated with the scope, then this is that registry
semver?
optional semver: string;spec to resolve against available versions
spec
spec: stringthe full named specifier passed to the constructor
subspec?
optional subspec: SpecLikeBase;in bar@npm:[email protected], this is the spec for [email protected]
type
type: SpecTypethe type of spec that this is, ultimately
workspace?
optional workspace: string;the package name or path of the workspace being referenced
workspaceSpec?
optional workspaceSpec: string;the specifier when using workspace: specs This can be either a
semver range, *, ~, or ^, if the name is not modified. Or, it
can include a workspace package name or path, like
workspace:packages/foo@* or workspace:@scope/foo@*.
inheritedRegistry
Set Signature
set inheritedRegistry(reg): voidtracks the registry that this spec should inherit from
Parameters
reg
undefined | string
Returns
void
toString()
Returns
string
SpecOptions
type SpecOptions = { [k in keyof SpecOptionsFilled]?: SpecOptionsFilled[k]}Defined in: spec/src/types.ts:3
SpecOptionsFilled
type SpecOptionsFilled = objectDefined in: spec/src/types.ts:9
Type declaration
catalog
catalog: Record<string, string>catalogs
catalogs: Record<string, Record<string, string>>git-host-archives
git-host-archives: Record<string, string>;tarball hosting services for hosts listed in git-hosts
git-hosts
git-hosts: Record<string, string>;shorthand prefix names for known git hosts
jsr-registries
jsr-registries: Record<string, string>;registries that work like https://npm.jsr.io
registries
registries: Record<string, string>shorthand prefix names for known registries
registry
registry: stringthe registry where a spec should be resolved against
scope-registries
scope-registries: Record<Scope, string>;registries mapped to a @scope
SpecType
type SpecType = | 'file' | 'git' | 'registry' | 'remote' | 'workspace' | 'catalog'Defined in: spec/src/types.ts:31
References
defaultGitHostArchives
Re-exports defaultGitHostArchives
defaultGitHosts
Re-exports defaultGitHosts
defaultJsrRegistries
Re-exports defaultJsrRegistries
defaultRegistries
Re-exports defaultRegistries
defaultRegistry
Re-exports defaultRegistry
defaultScopeRegistries
Re-exports defaultScopeRegistries
getNormalizeFile
Re-exports getNormalizeFile
getOptions
Re-exports getOptions
gitHostWebsites
Re-exports gitHostWebsites
isSpec
Re-exports isSpec
kCustomInspect
Re-exports kCustomInspect
NodeJSDependenciesOptions
Re-exports NodeJSDependenciesOptions