Skip to content

@vltpkg/spec/browser

Classes

Spec

Defined in: spec/src/browser.ts:149

The base, isomorphic Spec implementation.

Extended by

Implements

Constructors

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

Defined in: spec/src/browser.ts:263

Parameters
name

string

bareSpec

string

options?

SpecOptions

Returns

Spec

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

Defined in: spec/src/browser.ts:264

Parameters
spec

string

options?

SpecOptions

Returns

Spec

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

Defined in: spec/src/browser.ts:265

Parameters
spec

string | Spec

bareOrOptions?

string | SpecOptions

options?

SpecOptions

Returns

Spec

Properties

bareSpec
bareSpec: string

Defined in: spec/src/browser.ts:213

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

Implementation of
SpecLike.bareSpec
constructor
constructor: typeof Spec

Defined in: spec/src/browser.ts:261

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

conventionalRegistryTarball?
optional conventionalRegistryTarball: string;

Defined in: spec/src/browser.ts:225

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: spec/src/browser.ts:228

a dist-tag like ‘latest’

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

Defined in: spec/src/browser.ts:230

file path for file:// url specs

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

Defined in: spec/src/browser.ts:217

the commit value we will check out

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

Defined in: spec/src/browser.ts:214

the git remote to fetch from

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

Defined in: spec/src/browser.ts:215

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

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

Defined in: spec/src/browser.ts:216

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

Implementation of
SpecLike.gitSelectorParsed
name
name: string

Defined in: spec/src/browser.ts:210

the name portion, so foo in [email protected]

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

Defined in: spec/src/browser.ts:218

github, gitlab, bitbucket, gist, etc.

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

Defined in: spec/src/browser.ts:219

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

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

Defined in: spec/src/browser.ts:222

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: spec/src/browser.ts:209

options passed to the constructor, plus defaults

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

Defined in: spec/src/browser.ts:227

parsed semver range specifier

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

Defined in: spec/src/browser.ts:223

registry to consult to resolve this spec

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

Defined in: spec/src/browser.ts:224

semver range or dist-tag for resolving against a packument

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

Defined in: spec/src/browser.ts:229

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: spec/src/browser.ts:211

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

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

Defined in: spec/src/browser.ts:212

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: spec/src/browser.ts:226

spec to resolve against available versions

Implementation of
SpecLike.semver
spec
spec: string

Defined in: spec/src/browser.ts:208

the full named specifier passed to the constructor

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

Defined in: spec/src/browser.ts:231

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: spec/src/browser.ts:207

the type of spec that this is, ultimately

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

Defined in: spec/src/browser.ts:221

the package name or path of the workspace being referenced

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

Defined in: spec/src/browser.ts:220

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: spec/src/browser.ts:205

Accessors

final
Get Signature
get final(): Spec

Defined in: spec/src/browser.ts:240

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: spec/src/browser.ts:575

Returns

string

toString()
toString(): string

Defined in: spec/src/browser.ts:251

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: spec/src/browser.ts:156

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: spec/src/browser.ts:161

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: spec/src/browser.ts:162

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: spec/src/browser.ts:173

Parameters
specOrBareSpec

string

opts?

SpecOptions

Returns

Spec

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

Defined in: spec/src/browser.ts:626

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: spec/src/browser.ts:138

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: spec/src/browser.ts:29

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: spec/src/browser.ts:22

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: spec/src/browser.ts:18

Type declaration

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

defaultRegistry

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

Defined in: spec/src/browser.ts:16


defaultScopeRegistries

const defaultScopeRegistries: object = {}

Defined in: spec/src/browser.ts:52


gitHostWebsites

const gitHostWebsites: object

Defined in: spec/src/browser.ts:45

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: spec/src/browser.ts:14

Functions

getNormalizeFile()

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

Defined in: spec/src/browser.ts:702

Parameters

opts?

NodeJSDependenciesOptions

Returns

Function

Parameters
bareSpec

string

spec

Spec

Returns

[string, string]


getOptions()

function getOptions(options?): SpecOptionsFilled

Defined in: spec/src/browser.ts:54

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