1 | import { PortablePath } from '@yarnpkg/fslib';
|
2 | import { FetchResult } from './Fetcher';
|
3 | import { Descriptor, Locator, Package, LocatorHash } from './types';
|
4 | export declare enum BuildType {
|
5 | SCRIPT = 0,
|
6 | SHELLCODE = 1
|
7 | }
|
8 | export declare type BuildDirective = [BuildType, string];
|
9 | export declare type InstallStatus = {
|
10 | packageLocation: PortablePath | null;
|
11 | buildDirective: Array<BuildDirective> | null;
|
12 | };
|
13 | export declare type FinalizeInstallStatus = {
|
14 | locatorHash: LocatorHash;
|
15 | buildLocations: Array<PortablePath>;
|
16 | buildDirective: Array<BuildDirective>;
|
17 | };
|
18 | export interface Installer {
|
19 | /**
|
20 | * Install a package on the disk.
|
21 | *
|
22 | * Should return `null` if the package has no install steps, or an object
|
23 | * describing the various scripts that need to be run otherwise.
|
24 | *
|
25 | * Note that this function isn't called in any specific order. In particular,
|
26 | * this means that the order in which this function is called will not
|
27 | * necessarily match the order in which the packages will be built.
|
28 | *
|
29 | * This function is guaranteed to be called for all packages before the
|
30 | * dependencies start to be attached.
|
31 | *
|
32 | * @param pkg The package being installed
|
33 | * @param fetchResult The fetched information about the package
|
34 | */
|
35 | installPackage(pkg: Package, fetchResult: FetchResult): Promise<InstallStatus>;
|
36 | /**
|
37 | * Link a package and its internal (same-linker) dependencies.
|
38 | *
|
39 | * This function is guaranteed to be called for all packages before the
|
40 | * install is finalized.
|
41 | *
|
42 | * @param locator The package itself
|
43 | * @param dependencies The package dependencies
|
44 | */
|
45 | attachInternalDependencies(locator: Locator, dependencies: Array<[Descriptor, Locator]>): Promise<void>;
|
46 | /**
|
47 | * Link a package to the location of the external packages that depend on
|
48 | * it (only the location is available, since two linkers should be generic
|
49 | * enough to not have to make custom integrations).
|
50 | *
|
51 | * Will never be called for packages supported by the same linker (they'll
|
52 | * be linked through the `attachInternalDependencies` hook instead).
|
53 | *
|
54 | * This function is guaranteed to be called for all packages before the
|
55 | * install is finalized.
|
56 | *
|
57 | * @param locator
|
58 | * @param locations
|
59 | */
|
60 | attachExternalDependents(locator: Locator, dependentPaths: Array<PortablePath>): Promise<void>;
|
61 | /**
|
62 | * Finalize the install by writing miscellaneous files to the disk.
|
63 | */
|
64 | finalizeInstall(): Promise<Array<FinalizeInstallStatus> | void>;
|
65 | }
|