Skip to content

Classes

Spec

Defined in: index.ts:34

The base, isomorphic Spec implementation.

Extends

Implements

Constructors

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

Defined in: browser.ts:265

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

Parameters
name

string

bareSpec

string

options?

SpecOptions

Returns

Spec

Inherited from

Spec.constructor

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

Defined in: browser.ts:266

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

Parameters
spec

string

options?

SpecOptions

Returns

Spec

Inherited from

Spec.constructor

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

Defined in: browser.ts:267

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

Parameters
spec

string | Spec

bareOrOptions?

string | SpecOptions

options?

SpecOptions

Returns

Spec

Inherited from

Spec.constructor

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
Inherited from

Spec.bareSpec

constructor
constructor: typeof Spec

Defined in: browser.ts:263

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

Inherited from
BrowserSpec.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
Inherited from

Spec.conventionalRegistryTarball

distTag?
optional distTag: string;

Defined in: browser.ts:230

a dist-tag like ‘latest’

Implementation of
SpecLike.distTag
Inherited from

Spec.distTag

file?
optional file: string;

Defined in: browser.ts:232

file path for file:// url specs

Implementation of
SpecLike.file
Inherited from

Spec.file

gitCommittish?
optional gitCommittish: string;

Defined in: browser.ts:219

the commit value we will check out

Implementation of
SpecLike.gitCommittish
Inherited from

Spec.gitCommittish

gitRemote?
optional gitRemote: string;

Defined in: browser.ts:216

the git remote to fetch from

Implementation of
SpecLike.gitRemote
Inherited from

Spec.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
Inherited from

Spec.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
Inherited from

Spec.gitSelectorParsed

name
name: string

Defined in: browser.ts:212

the name portion, so foo in [email protected]

Implementation of
SpecLike.name
Inherited from

Spec.name

namedGitHost?
optional namedGitHost: string;

Defined in: browser.ts:220

github, gitlab, bitbucket, gist, etc.

Implementation of
SpecLike.namedGitHost
Inherited from

Spec.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
Inherited from

Spec.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
Inherited from

Spec.namedRegistry

options
options: SpecOptionsFilled

Defined in: browser.ts:211

options passed to the constructor, plus defaults

Implementation of
SpecLike.options
Inherited from

Spec.options

range?
optional range: Range;

Defined in: browser.ts:229

parsed semver range specifier

Implementation of
SpecLike.range
Inherited from

Spec.range

registry?
optional registry: string;

Defined in: browser.ts:225

registry to consult to resolve this spec

Implementation of
SpecLike.registry
Inherited from

Spec.registry

registrySpec?
optional registrySpec: string;

Defined in: browser.ts:226

semver range or dist-tag for resolving against a packument

Implementation of
SpecLike.registrySpec
Inherited from

Spec.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
Inherited from

Spec.remoteURL

scope?
optional scope: `@${string}`;

Defined in: browser.ts:213

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

Implementation of
SpecLike.scope
Inherited from

Spec.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
Inherited from

Spec.scopeRegistry

semver?
optional semver: string;

Defined in: browser.ts:228

spec to resolve against available versions

Implementation of
SpecLike.semver
Inherited from

Spec.semver

spec
spec: string

Defined in: browser.ts:210

the full named specifier passed to the constructor

Implementation of
SpecLike.spec
Inherited from

Spec.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
Inherited from

Spec.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
Inherited from

Spec.type

workspace?
optional workspace: string;

Defined in: browser.ts:223

the package name or path of the workspace being referenced

Implementation of
SpecLike.workspace
Inherited from

Spec.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
Inherited from

Spec.workspaceSpec

nodejsDependencies?
static optional nodejsDependencies: NodeJSDependenciesOptions;

Defined in: browser.ts:207

Inherited from

Spec.nodejsDependencies

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
Inherited from

Spec.final

Methods

[kCustomInspect]()
kCustomInspect: string

Defined in: index.ts:35

Parameters
_depth?

number

options?

InspectOptions

Returns

string

Overrides

Spec.[kCustomInspect]

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
Inherited from

Spec.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

Inherited from

Spec.parse

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

Inherited from

Spec.parse

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

Inherited from

Spec.parse

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

Defined in: browser.ts:175

Parameters
specOrBareSpec

string

opts?

SpecOptions

Returns

Spec

Inherited from

Spec.parseArgs

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]

Inherited from

Spec.parseGitSelector

Type Aliases

GitSelectorParsed

type GitSelectorParsed = object

Defined in: types.ts:22

Type declaration

path?
optional path: string;
semver?
optional semver: string;

Scope

type Scope = `@${string}`

Defined in: types.ts:7


SpecLike<Type>

type SpecLike<Type> = SpecLikeBase & object

Defined in: types.ts:133

Type declaration

final
final: Type
subspec?
optional subspec: Type;

Type Parameters

Type extends SpecLikeBase


SpecLikeBase

type SpecLikeBase = object

Defined in: types.ts:27

Type declaration

bareSpec
bareSpec: string

just 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: SpecLikeBase

getter 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: string

the 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: SpecOptionsFilled

options passed to the constructor, plus defaults

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

the 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: 'file' | 'git' | 'registry' | 'remote' | 'workspace'

the 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@*.

toString()
Returns

string


SpecOptions

type SpecOptions = {
[k in keyof SpecOptionsFilled]?: SpecOptionsFilled[k]
}

Defined in: types.ts:3


SpecOptionsFilled

type SpecOptionsFilled = object

Defined in: types.ts:9

Type declaration

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

registries
registries: Record<string, string>

shorthand prefix names for known registries

registry
registry: string

the registry where a spec should be resolved against

scope-registries
scope-registries: Record<Scope, string>;

registries mapped to a @scope

References

defaultGitHostArchives

Re-exports defaultGitHostArchives

defaultGitHosts

Re-exports defaultGitHosts

defaultRegistries

Re-exports defaultRegistries

defaultRegistry

Re-exports defaultRegistry

defaultScopeRegistries

Re-exports defaultScopeRegistries

getOptions

Re-exports getOptions

gitHostWebsites

Re-exports gitHostWebsites

kCustomInspect

Re-exports kCustomInspect