Options
All
  • Public
  • Public/Protected
  • All
Menu

Package plugin-npm

@yarnpkg/plugin-npm

This plugin adds support for downloading packages from the npm registry.

Install

This plugin is included by default in Yarn.

Type aliases

Options

Options: httpUtils.Options & RegistryOptions & object

RegistryOptions

RegistryOptions: object | object

Variables

Const NODE_GYP_IDENT

NODE_GYP_IDENT: Ident = structUtils.makeIdent(null, `node-gyp`)

Const NODE_GYP_MATCH

NODE_GYP_MATCH: RegExp = /\b(node-gyp|prebuild-install)\b/

Const PROTOCOL

PROTOCOL: "npm:" = `npm:`

Functions

askForOtp

  • askForOtp(error: any, __namedParameters: object): Promise<string>

customPackageError

  • customPackageError(error: RequestError, configuration: Configuration): null | string

del

  • del(path: string, __namedParameters: object): Promise<Buffer>

get

  • get(path: string, __namedParameters: object): Promise<any>

getAuditRegistry

  • getAuditRegistry(__namedParameters: object): string

getAuthConfiguration

  • getAuthConfiguration(registry: string, __namedParameters: object): MapLike

getAuthenticationHeader

  • getAuthenticationHeader(registry: string, __namedParameters: object): Promise<null | string>

getDefaultRegistry

  • getDefaultRegistry(__namedParameters: object): string

getGitHead

  • getGitHead(workingDir: PortablePath): Promise<undefined | string>

getIdentUrl

  • getIdentUrl(ident: Ident): string

getOtpHeaders

  • getOtpHeaders(otp: string): object

getPublishRegistry

  • getPublishRegistry(manifest: Manifest, __namedParameters: object): string

getRegistryConfiguration

  • getRegistryConfiguration(registry: string, __namedParameters: object): MapLike | null

getScopeConfiguration

  • getScopeConfiguration(scope: string | null, __namedParameters: object): MapLike | null

getScopeRegistry

  • getScopeRegistry(scope: string | null, __namedParameters: object): string

handleInvalidAuthenticationError

  • handleInvalidAuthenticationError(error: any, __namedParameters: object): Promise<void>
  • Consumes all 401 Unauthorized errors and reports them as AUTHENTICATION_INVALID.

    It doesn't handle 403 Forbidden, as the npm registry uses it when the user attempts a prohibited action, such as publishing a package with a similar name to an existing package.

    It doesn't handle 403 Forbidden, as the npm registry uses it when the user attempts a prohibited action, such as publishing a package with a similar name to an existing package.

    Parameters

    • error: any
    • __namedParameters: object
      • attemptedAs: undefined | string
      • configuration: Configuration
      • headers: undefined | object
      • registry: string

    Returns Promise<void>

isOtpError

  • isOtpError(error: any): any

Const makeConfiguration

makePublishBody

  • makePublishBody(workspace: Workspace, buffer: Buffer, __namedParameters: object): Promise<object>

normalizeRegistry

  • normalizeRegistry(registry: string): string

post

  • post(path: string, body: httpUtils.Body, __namedParameters: object): Promise<Buffer>

put

  • put(path: string, body: httpUtils.Body, __namedParameters: object): Promise<Buffer>

shouldAuthenticate

whoami

  • whoami(registry: string, headers: object | undefined, __namedParameters: object): Promise<any>

Object literals

Const authSettings

authSettings: object

npmAlwaysAuth

npmAlwaysAuth: object

default

default: boolean = false

description

description: string = `URL of the selected npm registry (note: npm enterprise isn't supported)`

type

type: BOOLEAN = SettingsType.BOOLEAN as const

npmAuthIdent

npmAuthIdent: object

default

default: null = null

description

description: string = `Authentication identity for the npm registry (_auth in npm and yarn v1)`

type

type: SECRET = SettingsType.SECRET as const

npmAuthToken

npmAuthToken: object

default

default: null = null

description

description: string = `Authentication token for the npm registry (_authToken in npm and yarn v1)`

type

type: SECRET = SettingsType.SECRET as const

Const plugin

plugin: object

fetchers

fetchers: (NpmSemverFetcher | NpmHttpFetcher)[] = [NpmHttpFetcher,NpmSemverFetcher,]

resolvers

resolvers: (NpmSemverResolver | NpmTagResolver)[] = [NpmRemapResolver,NpmSemverResolver,NpmTagResolver,]

configuration

configuration: object

npmRegistries

npmRegistries: object

description

description: string = `Settings per registry`

normalizeKeys

normalizeKeys: normalizeRegistry = npmConfigUtils.normalizeRegistry

type

type: MAP = SettingsType.MAP

valueDefinition

valueDefinition: object

description

description: string = ``

type

type: SHAPE = SettingsType.SHAPE

properties

properties: object

npmScopes

npmScopes: object

description

description: string = `Settings per package scope`

type

type: MAP = SettingsType.MAP

valueDefinition

valueDefinition: object

description

description: string = ``

type

type: SHAPE = SettingsType.SHAPE

properties

properties: object

Const registrySettings

registrySettings: object

npmAuditRegistry

npmAuditRegistry: object

default

default: null = null

description

description: string = `Registry to query for audit reports`

type

type: STRING = SettingsType.STRING as const

npmPublishRegistry

npmPublishRegistry: object

default

default: null = null

description

description: string = `Registry to push packages to`

type

type: STRING = SettingsType.STRING as const

npmRegistryServer

npmRegistryServer: object

default

default: string = `https://registry.yarnpkg.com`

description

description: string = `URL of the selected npm registry (note: npm enterprise isn't supported)`

type

type: STRING = SettingsType.STRING as const

Generated using TypeDoc