Skip to content

@vltpkg/spec/browser

Classes

Spec

Defined in: browser.ts:151

The base, isomorphic Spec implementation.

Extended by

Implements

Constructors

new Spec()
new Spec(
name,
bareSpec,
options?): Spec

Defined in: browser.ts:265

Parameters
name

string

bareSpec

string

options?

SpecOptions

Returns

Spec

new Spec()
new Spec(spec, options?): Spec

Defined in: browser.ts:266

Parameters
spec

string

options?

SpecOptions

Returns

Spec

new Spec()
new Spec(
spec,
bareOrOptions?,
options?): Spec

Defined in: browser.ts:267

Parameters
spec

string | Spec

bareOrOptions?

string | SpecOptions

options?

SpecOptions

Returns

Spec

Properties

bareSpec
bareSpec: string

Defined in: browser.ts:215

just the part AFTER the name, so 1.x in [email protected]

Implementation of
SpecLike.bareSpec
constructor
constructor: typeof Spec

Defined in: browser.ts:263

The initial value of Object.prototype.constructor is the standard built-in Object constructor.

conventionalRegistryTarball?
optional conventionalRegistryTarball: string;

Defined in: browser.ts:227

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.conventionalRegistryTarball
distTag?
optional distTag: string;

Defined in: browser.ts:230

a dist-tag like ‘latest’

Implementation of
SpecLike.distTag
file?
optional file: string;

Defined in: browser.ts:232

file path for file:// url specs

Implementation of
SpecLike.file
gitCommittish?
optional gitCommittish: string;

Defined in: browser.ts:219

the commit value we will check out

Implementation of
SpecLike.gitCommittish
gitRemote?
optional gitRemote: string;

Defined in: browser.ts:216

the git remote to fetch from

Implementation of
SpecLike.gitRemote
gitSelector?
optional gitSelector: string;

Defined in: browser.ts:217

the committish, semver range, and/or path portion of a git remote

Implementation of
SpecLike.gitSelector
gitSelectorParsed?
optional gitSelectorParsed: GitSelectorParsed;

Defined in: browser.ts:218

the parsed ’::‘-separated key/value pairs: semver:<range> and path:<subpath>

Implementation of
SpecLike.gitSelectorParsed
name
name: string

Defined in: browser.ts:212

the name portion, so foo in [email protected]

Implementation of
SpecLike.name
namedGitHost?
optional namedGitHost: string;

Defined in: browser.ts:220

github, gitlab, bitbucket, gist, etc.

Implementation of
SpecLike.namedGitHost
namedGitHostPath?
optional namedGitHostPath: string;

Defined in: browser.ts:221

the path that’s parsed when we have a named git host

Implementation of
SpecLike.namedGitHostPath
namedRegistry?
optional namedRegistry: string;

Defined in: browser.ts:224

In specs like foo@npm:bar@1, this is the ‘npm’ part. Other registries can be mapped using the registries option.

Implementation of
SpecLike.namedRegistry
options
options: SpecOptionsFilled

Defined in: browser.ts:211

options passed to the constructor, plus defaults

Implementation of
SpecLike.options
range?
optional range: Range;

Defined in: browser.ts:229

parsed semver range specifier

Implementation of
SpecLike.range
registry?
optional registry: string;

Defined in: browser.ts:225

registry to consult to resolve this spec

Implementation of
SpecLike.registry
registrySpec?
optional registrySpec: string;

Defined in: browser.ts:226

semver range or dist-tag for resolving against a packument

Implementation of
SpecLike.registrySpec
remoteURL?
optional remoteURL: string;

Defined in: browser.ts:231

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.remoteURL
scope?
optional scope: `@${string}`;

Defined in: browser.ts:213

the name’s scope, so @acme in @acme/[email protected]

Implementation of
SpecLike.scope
scopeRegistry?
optional scopeRegistry: string;

Defined in: browser.ts:214

if the name is scoped, and there’s a registry associated with the scope, then this is that registry

Implementation of
SpecLike.scopeRegistry
semver?
optional semver: string;

Defined in: browser.ts:228

spec to resolve against available versions

Implementation of
SpecLike.semver
spec
spec: string

Defined in: browser.ts:210

the full named specifier passed to the constructor

Implementation of
SpecLike.spec
subspec?
optional subspec: Spec;

Defined in: browser.ts:233

in bar@npm:[email protected], this is the spec for [email protected]

Implementation of
SpecLike.subspec
type
type: 'file' | 'git' | 'registry' | 'remote' | 'workspace'

Defined in: browser.ts:209

the type of spec that this is, ultimately

Implementation of
SpecLike.type
workspace?
optional workspace: string;

Defined in: browser.ts:223

the package name or path of the workspace being referenced

Implementation of
SpecLike.workspace
workspaceSpec?
optional workspaceSpec: string;

Defined in: browser.ts:222

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.workspaceSpec
nodejsDependencies?
static optional nodejsDependencies: NodeJSDependenciesOptions;

Defined in: browser.ts:207

Accessors

final
Get Signature
get final(): Spec

Defined in: browser.ts:242

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

Implementation of
SpecLike.final

Methods

[kCustomInspect]()
kCustomInspect: string

Defined in: browser.ts:577

Returns

string

toString()
toString(): string

Defined in: browser.ts:253

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.toString
parse()
Call Signature
static parse(
name,
bareSpec,
options?): Spec

Defined in: browser.ts:158

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?

SpecOptions

Returns

Spec

Call Signature
static parse(spec, options?): Spec

Defined in: browser.ts:163

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?

SpecOptions

Returns

Spec

Call Signature
static parse(spec, options?): Spec

Defined in: browser.ts:164

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

Spec

options?

SpecOptions

Returns

Spec

parseArgs()
static parseArgs(specOrBareSpec, opts?): Spec

Defined in: browser.ts:175

Parameters
specOrBareSpec

string

opts?

SpecOptions

Returns

Spec

parseGitSelector()
static parseGitSelector(selector, spec?): [GitSelectorParsed, string, Range]

Defined in: browser.ts:628

Should only ever be called with the bit that comes AFTER the # in the git remote url.

Parameters
selector

string

spec?

Spec

Returns

[GitSelectorParsed, string, Range]

Type Aliases

NodeJSDependenciesOptions

type NodeJSDependenciesOptions = object

Defined in: browser.ts:140

Injects the Node.js dependencies into the Spec class.

Type declaration

homedir
homedir: homedir
isAbsolute
isAbsolute: isAbsolute
join
join: join
resolve
resolve: resolve
winPath
winPath: win32

Variables

defaultGitHostArchives

const defaultGitHostArchives: object

Defined in: browser.ts:31

Type declaration

bitbucket
bitbucket: string =
'https://bitbucket.org/$1/$2/get/$committish.tar.gz'
gist
gist: string =
'https://codeload.github.com/gist/$1/tar.gz/$committish'
github
github: string =
'https://codeload.github.com/$1/$2/tar.gz/$committish'
gitlab
gitlab: string =
'https://gitlab.com/$1/$2/repository/archive.tar.gz?ref=$committish'

defaultGitHosts

const defaultGitHosts: object

Defined in: browser.ts:24

Type declaration

bitbucket
bitbucket: string = 'git+ssh://[email protected]:$1/$2.git'
gist
gist: string = 'git+ssh://[email protected]/$1.git'
github
github: string = 'git+ssh://[email protected]:$1/$2.git'
gitlab
gitlab: string = 'git+ssh://[email protected]:$1/$2.git'

defaultRegistries

const defaultRegistries: object

Defined in: browser.ts:20

Type declaration

npm
npm: string = 'https://registry.npmjs.org/'

defaultRegistry

const defaultRegistry: 'https://registry.npmjs.org/' =
'https://registry.npmjs.org/'

Defined in: browser.ts:18


defaultScopeRegistries

const defaultScopeRegistries: object = {}

Defined in: browser.ts:54


gitHostWebsites

const gitHostWebsites: object

Defined in: browser.ts:47

These are just for legacy support of urls that are supported by npm and observed in the wild.

Not configurable, because no more will be added. If you wish to define custom git hosts, use it with the 'git-hosts' and 'git-host-archives' options.

Type declaration

bitbucket
bitbucket: string = 'https://bitbucket.org/'
gist
gist: string = 'https://gist.github.com/'
github
github: string = 'https://github.com/'
gitlab
gitlab: string = 'https://gitlab.com/'

kCustomInspect

const kCustomInspect: typeof kCustomInspect

Defined in: browser.ts:16

Functions

getNormalizeFile()

function getNormalizeFile(opts?): (bareSpec, spec) => [string, string]

Defined in: browser.ts:704

Parameters

opts?

NodeJSDependenciesOptions

Returns

Function

Parameters
bareSpec

string

spec

Spec

Returns

[string, string]


getOptions()

function getOptions(options?): SpecOptionsFilled

Defined in: browser.ts:56

Parameters

options?

SpecOptions

Returns

SpecOptionsFilled

References

GitSelectorParsed

Re-exports GitSelectorParsed

Scope

Re-exports Scope

SpecLike

Re-exports SpecLike

SpecLikeBase

Re-exports SpecLikeBase

SpecOptions

Re-exports SpecOptions

SpecOptionsFilled

Re-exports SpecOptionsFilled