ApiModule · packages/server/src/plugin/packages.ts:56

NpmPluginPackages

component

No JSDoc comment in source yet.

API

@Component()
export class NpmPluginPackages implements PluginPackages {
  constructor(private readonly io: PluginPackagesIo = machine);
  check(root: string, spec: string): Promise<void>;
  install(root: string, source: string): Promise<InstalledPackage>;
  installFiles(root: string, files: Record<string, Uint8Array>): Promise<InstalledPackage>;
  installTarball(root: string, file: string, name: string): Promise<InstalledPackage>;
  installChannel(root: string, channel: IndexChannel, opts: { onProgress?: (received: number, total: number | null) => void } = {}): Promise<InstalledPackage>;
  remove(root: string, name: string): Promise<void>;
}

Dependencies & Wiring

Extracted from class decorators
implementsinterfaces

Methods (6)

check

check(root: string, spec: string): Promise<void>

Whether the registry has a name, asked before it is installed: npm view within a short window (install.ts checkPluginSource); without npm, the registry's document, each address within the same window (direct-install.ts checkFromRegistry).

@paramrootstring
@paramspecstring
@returnsPromise<void>

install

install(root: string, source: string): Promise<InstalledPackage>

By name or by link (install.ts installPluginSource; without npm, by name only).

@paramrootstring
@paramsourcestring
@returnsPromise<InstalledPackage>

installFiles

installFiles(root: string, files: Record<string, Uint8Array>): Promise<InstalledPackage>

An uploaded package's files (install.ts installPluginFiles).

@paramrootstring
@paramfilesRecord<string, Uint8Array>
@returnsPromise<InstalledPackage>

installTarball

installTarball(root: string, file: string, name: string): Promise<InstalledPackage>

A verified package tarball on this machine, an offline archive: npm installs it (install.ts installPluginTarball); without npm, it is placed directly (direct-install.ts installTarball).

@paramrootstring
@paramfilestring
@paramnamestring
@returnsPromise<InstalledPackage>

installChannel

installChannel(root: string, channel: IndexChannel, opts: { onProgress?: (received: number, total: number | null) => void } = {}): Promise<InstalledPackage>

A version from the published index's release channel (install.ts installPluginChannel).

@paramrootstring
@paramchannelIndexChannel
@paramopts?{ onProgress?: (received: number, total: number | null) => void }
@returnsPromise<InstalledPackage>

remove

remove(root: string, name: string): Promise<void>
@paramrootstring
@paramnamestring
@returnsPromise<void>