vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • browser
    • index
    • Reference
  • Classes
  • Spec
  • Type Aliases
  • NodeJSDependenciesOptions
  • Variables
  • defaultGitHostArchives
  • defaultGitHosts
  • defaultJsrRegistries
  • defaultRegistries
  • defaultRegistryName
  • defaultScopeRegistries
  • gitHostWebsites
  • kCustomInspect
  • Functions
  • currentDefaultRegistryName()
  • getNormalizeFile()
  • getOptions()
  • isSpec()
  • References
  • assertPathSafeName
  • GitSelectorParsed
  • isPathSafeName
  • Scope
  • SpecLike
  • SpecLikeBase
  • SpecOptions
  • SpecOptionsFilled
  • SpecType
  1. Client
  2. /
  3. API Reference
  4. /
  5. @vltpkg/spec
  6. /
  7. browser

browser

Classes

Spec

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

The base, isomorphic Spec implementation.

Extended by

  • Spec

Implements

  • SpecLike<Spec>

Constructors

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

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

Parameters
ParameterType
namestring
bareSpecstring
options?SpecOptions
Returns

Spec

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

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

Parameters
ParameterType
specstring
options?SpecOptions
Returns

Spec

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

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

Parameters
ParameterType
specstring | Spec
bareOrOptions?string | SpecOptions
options?SpecOptions
Returns

Spec

Properties

PropertyTypeDefault valueDescription
bareSpecstringundefinedjust the part AFTER the name, so 1.x in foo@1.x
catalog?stringundefined-
constructortypeof SpecundefinedThe initial value of Object.prototype.constructor is the standard built-in Object constructor.
conventionalRegistryTarball?stringundefinedconventional 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?stringundefineda dist-tag like 'latest'
file?stringundefinedfile path for file:// url specs
gitCommittish?stringundefinedthe commit value we will check out
gitRemote?stringundefinedthe git remote to fetch from
gitSelector?stringundefinedthe committish, semver range, and/or path portion of a git remote
gitSelectorParsed?GitSelectorParsedundefinedthe parsed '::'-separated key/value pairs: semver:<range> and path:<subpath>
namestringundefinedthe name portion, so foo in foo@1.x
namedGitHost?stringundefinedgithub, gitlab, bitbucket, gist, etc.
namedGitHostPath?stringundefinedthe path that's parsed when we have a named git host
namedJsrRegistry?stringundefined-
namedRegistry?stringundefinedIn specs like foo@npm:bar@1, this is the 'npm' part. Other registries can be mapped using the registries option.
optionsSpecOptionsFilledundefinedoptions passed to the constructor, plus defaults
overriddenbooleanfalseIs this a spec that overrides another spec?
range?Rangeundefinedparsed semver range specifier
registry?stringundefinedregistry to consult to resolve this spec
registrySpec?stringundefinedsemver range or dist-tag for resolving against a packument
remoteURL?stringundefinedURL 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?`@${string}`undefinedthe name's scope, so @acme in @acme/foo@1.x
scopeRegistry?stringundefinedif the name is scoped, and there's a registry associated with the scope, then this is that registry
semver?stringundefinedspec to resolve against available versions
specstringundefinedthe full named specifier passed to the constructor
subspec?Specundefinedin bar@npm:foo@1.x, this is the spec for foo@1.x
typeSpecTypeundefinedthe type of spec that this is, ultimately
workspace?stringundefinedthe package name or path of the workspace being referenced
workspaceSpec?stringundefinedthe 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@*.
nodejsDependencies?NodeJSDependenciesOptionsundefined-

Accessors

final
Get Signature
TypeScript
get final(): Spec & object

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

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
TypeScript
SpecLike.final

Methods

[kCustomInspect]()
TypeScript
kCustomInspect: string

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

Returns

string

toString()
TypeScript
toString(): string

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

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

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

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
ParameterType
namestring
bareSpecstring
options?SpecOptions
Returns

Spec

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

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

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
ParameterType
specstring
options?SpecOptions
Returns

Spec

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

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

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
ParameterType
specSpec
options?SpecOptions
Returns

Spec

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

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

Parameters
ParameterType
specOrBareSpecstring
opts?SpecOptions
Returns

Spec

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

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

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

Parameters
ParameterType
selectorstring
spec?Spec
Returns

[GitSelectorParsed, string, Range]

Type Aliases

NodeJSDependenciesOptions

TypeScript
type NodeJSDependenciesOptions = object;

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

Injects the Node.js dependencies into the Spec class.

Type declaration

NameType
homedirhomedir
isAbsoluteisAbsolute
joinjoin
resolveresolve
winPathwin32

Variables

defaultGitHostArchives

TypeScript
const defaultGitHostArchives: object;

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

Type declaration

NameTypeDefault value
bitbucketstring'https://bitbucket.org/$1/$2/get/$committish.tar.gz'
giststring'https://codeload.github.com/gist/$1/tar.gz/$committish'
githubstring'https://api.github.com/repos/$1/$2/tarball/$committish'
gitlabstring'https://gitlab.com/$1/$2/repository/archive.tar.gz?ref=$committish'

defaultGitHosts

TypeScript
const defaultGitHosts: object;

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

Type declaration

NameTypeDefault value
bitbucketstring'git+ssh://git@bitbucket.org:$1/$2.git'
giststring'git+ssh://git@gist.github.com/$1.git'
githubstring'git+ssh://git@github.com:$1/$2.git'
gitlabstring'git+ssh://git@gitlab.com:$1/$2.git'

defaultJsrRegistries

TypeScript
const defaultJsrRegistries: object;

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

Type declaration

NameTypeDefault value
jsrstring'https://npm.jsr.io/'

defaultRegistries

TypeScript
const defaultRegistries: object;

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

Type declaration

NameTypeDefault value
ghstring'https://npm.pkg.github.com/'

defaultRegistryName

TypeScript
const defaultRegistryName: "npm" = 'npm';

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


defaultScopeRegistries

TypeScript
const defaultScopeRegistries: object;

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

Type declaration

NameTypeDefault value
@jsrstring'https://npm.jsr.io/'

gitHostWebsites

TypeScript
const gitHostWebsites: object;

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

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

NameTypeDefault value
bitbucketstring'https://bitbucket.org/'
giststring'https://gist.github.com/'
githubstring'https://github.com/'
gitlabstring'https://gitlab.com/'

kCustomInspect

TypeScript
const kCustomInspect: typeof kCustomInspect;

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

Functions

currentDefaultRegistryName()

TypeScript
function currentDefaultRegistryName(registry, options): undefined | string

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

Retrieves the short configured name of the default registry if one is available.

Parameters

ParameterType
registrystring
optionsSpecOptions

Returns

undefined | string


getNormalizeFile()

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

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

Parameters

ParameterType
opts?NodeJSDependenciesOptions

Returns

Function

Parameters
ParameterType
bareSpecstring
specSpec
Returns

[string, string]


getOptions()

TypeScript
function getOptions(options?): SpecOptionsFilled

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

Parameters

ParameterType
options?SpecOptions

Returns

SpecOptionsFilled


isSpec()

TypeScript
function isSpec(spec): spec is Spec

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

Parameters

ParameterType
specunknown

Returns

spec is Spec

References

assertPathSafeName

Re-exports assertPathSafeName

GitSelectorParsed

Re-exports GitSelectorParsed

isPathSafeName

Re-exports isPathSafeName

Scope

Re-exports Scope

SpecLike

Re-exports SpecLike

SpecLikeBase

Re-exports SpecLikeBase

SpecOptions

Re-exports SpecOptions

SpecOptionsFilled

Re-exports SpecOptionsFilled

SpecType

Re-exports SpecType


Previous@vltpkg/specNextindex

On this page

  • Classes
  • Spec
  • Type Aliases
  • NodeJSDependenciesOptions
  • Variables
  • defaultGitHostArchives
  • defaultGitHosts
  • defaultJsrRegistries
  • defaultRegistries
  • defaultRegistryName
  • defaultScopeRegistries
  • gitHostWebsites
  • kCustomInspect
  • Functions
  • currentDefaultRegistryName()
  • getNormalizeFile()
  • getOptions()
  • isSpec()
  • References
  • assertPathSafeName
  • GitSelectorParsed
  • isPathSafeName
  • Scope
  • SpecLike
  • SpecLikeBase
  • SpecOptions
  • SpecOptionsFilled
  • SpecType

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now