browser
Classes
Spec
Defined in: spec/src/browser.ts:239
The base, isomorphic Spec implementation.
Extended by
Implements
Constructors
new Spec()
new Spec(
name,
bareSpec,
options?): SpecDefined in: spec/src/browser.ts:368
Parameters
| Parameter | Type |
|---|---|
name | string |
bareSpec | string |
options? | SpecOptions |
Returns
new Spec()
new Spec(spec, options?): SpecDefined in: spec/src/browser.ts:369
Parameters
| Parameter | Type |
|---|---|
spec | string |
options? | SpecOptions |
Returns
new Spec()
new Spec(
spec,
bareOrOptions?,
options?): SpecDefined in: spec/src/browser.ts:370
Parameters
| Parameter | Type |
|---|---|
spec | string | Spec |
bareOrOptions? | string | SpecOptions |
options? | SpecOptions |
Returns
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
bareSpec | string | undefined | just the part AFTER the name, so 1.x in foo@1.x |
catalog? | string | undefined | - |
constructor | typeof Spec | undefined | The initial value of Object.prototype.constructor is the standard built-in Object constructor. |
conventionalRegistryTarball? | string | undefined | 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? | string | undefined | a dist-tag like 'latest' |
file? | string | undefined | file path for file:// url specs |
gitCommittish? | string | undefined | the commit value we will check out |
gitRemote? | string | undefined | the git remote to fetch from |
gitSelector? | string | undefined | the committish, semver range, and/or path portion of a git remote |
gitSelectorParsed? | GitSelectorParsed | undefined | the parsed '::'-separated key/value pairs: semver:<range> and path:<subpath> |
name | string | undefined | the name portion, so foo in foo@1.x |
namedGitHost? | string | undefined | github, gitlab, bitbucket, gist, etc. |
namedGitHostPath? | string | undefined | the path that's parsed when we have a named git host |
namedJsrRegistry? | string | undefined | - |
namedRegistry? | string | undefined | In specs like foo@npm:bar@1, this is the 'npm' part. Other registries can be mapped using the registries option. |
options | SpecOptionsFilled | undefined | options passed to the constructor, plus defaults |
overridden | boolean | false | Is this a spec that overrides another spec? |
range? | Range | undefined | parsed semver range specifier |
registry? | string | undefined | registry to consult to resolve this spec |
registrySpec? | string | undefined | semver range or dist-tag for resolving against a packument |
remoteURL? | string | undefined | 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? | `@${string}` | undefined | the name's scope, so @acme in @acme/foo@1.x |
scopeRegistry? | string | undefined | if the name is scoped, and there's a registry associated with the scope, then this is that registry |
semver? | string | undefined | spec to resolve against available versions |
spec | string | undefined | the full named specifier passed to the constructor |
subspec? | Spec | undefined | in bar@npm:foo@1.x, this is the spec for foo@1.x |
type | SpecType | undefined | the type of spec that this is, ultimately |
workspace? | string | undefined | the package name or path of the workspace being referenced |
workspaceSpec? | string | undefined | 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@*. |
nodejsDependencies? | NodeJSDependenciesOptions | undefined | - |
Accessors
final
Get Signature
get final(): Spec & objectDefined 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
SpecLike.finalMethods
[kCustomInspect]()
kCustomInspect: stringDefined in: spec/src/browser.ts:768
Returns
string
toString()
toString(): stringDefined 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
SpecLike.toStringparse()
Call Signature
static parse(
name,
bareSpec,
options?): SpecDefined 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
| Parameter | Type |
|---|---|
name | string |
bareSpec | string |
options? | SpecOptions |
Returns
Call Signature
static parse(spec, options?): SpecDefined 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
| Parameter | Type |
|---|---|
spec | string |
options? | SpecOptions |
Returns
Call Signature
static parse(spec, options?): SpecDefined 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
| Parameter | Type |
|---|---|
spec | Spec |
options? | SpecOptions |
Returns
parseArgs()
static parseArgs(specOrBareSpec, opts?): SpecDefined in: spec/src/browser.ts:263
Parameters
| Parameter | Type |
|---|---|
specOrBareSpec | string |
opts? | SpecOptions |
Returns
parseGitSelector()
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
| Parameter | Type |
|---|---|
selector | string |
spec? | Spec |
Returns
[GitSelectorParsed, string, Range]
Type Aliases
NodeJSDependenciesOptions
type NodeJSDependenciesOptions = object;Defined in: spec/src/browser.ts:196
Injects the Node.js dependencies into the Spec class.
Type declaration
| Name | Type |
|---|---|
homedir | homedir |
isAbsolute | isAbsolute |
join | join |
resolve | resolve |
winPath | win32 |
Variables
defaultGitHostArchives
const defaultGitHostArchives: object;Defined in: spec/src/browser.ts:34
Type declaration
| Name | Type | Default value |
|---|---|---|
bitbucket | string | 'https://bitbucket.org/$1/$2/get/$committish.tar.gz' |
gist | string | 'https://codeload.github.com/gist/$1/tar.gz/$committish' |
github | string | 'https://api.github.com/repos/$1/$2/tarball/$committish' |
gitlab | string | 'https://gitlab.com/$1/$2/repository/archive.tar.gz?ref=$committish' |
defaultGitHosts
const defaultGitHosts: object;Defined in: spec/src/browser.ts:27
Type declaration
| Name | Type | Default value |
|---|---|---|
bitbucket | string | 'git+ssh://git@bitbucket.org:$1/$2.git' |
gist | string | 'git+ssh://git@gist.github.com/$1.git' |
github | string | 'git+ssh://git@github.com:$1/$2.git' |
gitlab | string | 'git+ssh://git@gitlab.com:$1/$2.git' |
defaultJsrRegistries
const defaultJsrRegistries: object;Defined in: spec/src/browser.ts:25
Type declaration
| Name | Type | Default value |
|---|---|---|
jsr | string | 'https://npm.jsr.io/' |
defaultRegistries
const defaultRegistries: object;Defined in: spec/src/browser.ts:21
Type declaration
| Name | Type | Default value |
|---|---|---|
gh | string | 'https://npm.pkg.github.com/' |
defaultRegistryName
const defaultRegistryName: "npm" = 'npm';Defined in: spec/src/browser.ts:19
defaultScopeRegistries
const defaultScopeRegistries: object;Defined in: spec/src/browser.ts:57
Type declaration
| Name | Type | Default value |
|---|---|---|
@jsr | string | 'https://npm.jsr.io/' |
gitHostWebsites
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
| Name | Type | Default value |
|---|---|---|
bitbucket | string | 'https://bitbucket.org/' |
gist | string | 'https://gist.github.com/' |
github | string | 'https://github.com/' |
gitlab | string | 'https://gitlab.com/' |
kCustomInspect
const kCustomInspect: typeof kCustomInspect;Defined in: spec/src/browser.ts:17
Functions
currentDefaultRegistryName()
function currentDefaultRegistryName(registry, options): undefined | stringDefined in: spec/src/browser.ts:220
Retrieves the short configured name of the default registry if one is available.
Parameters
| Parameter | Type |
|---|---|
registry | string |
options | SpecOptions |
Returns
undefined | string
getNormalizeFile()
function getNormalizeFile(opts?): (bareSpec, spec) => [string, string]Defined in: spec/src/browser.ts:954
Parameters
| Parameter | Type |
|---|---|
opts? | NodeJSDependenciesOptions |
Returns
Function
Parameters
| Parameter | Type |
|---|---|
bareSpec | string |
spec | Spec |
Returns
[string, string]
getOptions()
function getOptions(options?): SpecOptionsFilledDefined in: spec/src/browser.ts:61
Parameters
| Parameter | Type |
|---|---|
options? | SpecOptions |
Returns
isSpec()
function isSpec(spec): spec is SpecDefined in: spec/src/browser.ts:204
Parameters
| Parameter | Type |
|---|---|
spec | unknown |
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