@prismshadow/penguin-server · packages/server/src/mechanisms/plugins.ts:20

PluginPackages

interface

PluginPackages: how plugin packages reach and leave the data root's npm prefix, as NpmPluginPackages implements it (plugin/packages.ts) — with npm, or without it for a package that needs nothing npm does on a machine that has none.

API

@Interface()
export abstract class PluginPackages {
  abstract check(root: string, spec: string): Promise<void>;
  abstract install(root: string, source: string): Promise<InstalledPackage>;
  abstract installFiles(root: string, files: Record<string, Uint8Array>): Promise<InstalledPackage>;
  abstract installTarball(root: string, file: string, name: string): Promise<InstalledPackage>;
  abstract installChannel(
      root: string,
      channel: IndexChannel,
      opts?: { onProgress?: (received: number, total: number | null) => void },
    ): Promise<InstalledPackage>;
  abstract remove(root: string, name: string): Promise<void>;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use
@Provideprovided by

Members (6)

check

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

Asks the registry whether it has a name (name, name@range) before it is installed, within a short window; throws npm's failure.

@paramrootstring
@paramspecstring
@returnsPromise<void>

install

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

A registry name (name, name@range) or a link npm fetches; answers which package that was.

@paramrootstring
@paramsourcestring
@returnsPromise<InstalledPackage>

installFiles

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

An uploaded package's files, relative path → bytes (checked by the caller).

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

installTarball

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

A package tarball already on this machine, verified by the caller (an offline archive).

@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, its bytes verified against the entry's sha512.

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

remove

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