UNPKG

4.56 kBTypeScriptView Raw
1/// <reference types="node" />
2import { NativePath, PortablePath } from '@yarnpkg/fslib';
3import { Readable, Writable } from 'stream';
4import { Configuration } from './Configuration';
5import { Project } from './Project';
6import { Report } from './Report';
7import { Workspace } from './Workspace';
8import { Locator } from './types';
9export declare function makeScriptEnv({ project, binFolder, lifecycleScript }: {
10 project?: Project;
11 binFolder: PortablePath;
12 lifecycleScript?: string;
13}): Promise<{
14 [key: string]: string;
15} & {
16 BERRY_BIN_FOLDER: string;
17}>;
18export declare function prepareExternalProject(cwd: PortablePath, outputPath: PortablePath, { configuration, report, workspace }: {
19 configuration: Configuration;
20 report: Report;
21 workspace?: string | null;
22}): Promise<void>;
23declare type HasPackageScriptOption = {
24 project: Project;
25};
26export declare function hasPackageScript(locator: Locator, scriptName: string, { project }: HasPackageScriptOption): Promise<boolean>;
27declare type ExecutePackageScriptOptions = {
28 cwd?: PortablePath | undefined;
29 project: Project;
30 stdin: Readable | null;
31 stdout: Writable;
32 stderr: Writable;
33};
34export declare function executePackageScript(locator: Locator, scriptName: string, args: Array<string>, { cwd, project, stdin, stdout, stderr }: ExecutePackageScriptOptions): Promise<number>;
35export declare function executePackageShellcode(locator: Locator, command: string, args: Array<string>, { cwd, project, stdin, stdout, stderr }: ExecutePackageScriptOptions): Promise<number>;
36declare type ExecuteWorkspaceScriptOptions = {
37 cwd?: PortablePath | undefined;
38 stdin: Readable | null;
39 stdout: Writable;
40 stderr: Writable;
41};
42export declare function executeWorkspaceScript(workspace: Workspace, scriptName: string, args: Array<string>, { cwd, stdin, stdout, stderr }: ExecuteWorkspaceScriptOptions): Promise<number>;
43export declare function hasWorkspaceScript(workspace: Workspace, scriptName: string): boolean;
44declare type ExecuteWorkspaceLifecycleScriptOptions = {
45 cwd?: PortablePath | undefined;
46 report: Report;
47};
48export declare function executeWorkspaceLifecycleScript(workspace: Workspace, lifecycleScriptName: string, { cwd, report }: ExecuteWorkspaceLifecycleScriptOptions): Promise<void>;
49export declare function maybeExecuteWorkspaceLifecycleScript(workspace: Workspace, lifecycleScriptName: string, opts: ExecuteWorkspaceLifecycleScriptOptions): Promise<void>;
50declare type GetPackageAccessibleBinariesOptions = {
51 project: Project;
52};
53/**
54 * Return the binaries that can be accessed by the specified package
55 *
56 * @param locator The queried package
57 * @param project The project owning the package
58 */
59export declare function getPackageAccessibleBinaries(locator: Locator, { project }: GetPackageAccessibleBinariesOptions): Promise<Map<string, [Locator, NativePath]>>;
60/**
61 * Return the binaries that can be accessed by the specified workspace
62 *
63 * @param workspace The queried workspace
64 */
65export declare function getWorkspaceAccessibleBinaries(workspace: Workspace): Promise<Map<string, [Locator, NativePath]>>;
66declare type ExecutePackageAccessibleBinaryOptions = {
67 cwd: PortablePath;
68 nodeArgs?: Array<string>;
69 project: Project;
70 stdin: Readable | null;
71 stdout: Writable;
72 stderr: Writable;
73};
74/**
75 * Execute a binary from the specified package.
76 *
77 * Note that "binary" in this sense means "a Javascript file". Actual native
78 * binaries cannot be executed this way, because we use Node in order to
79 * transparently read from the archives.
80 *
81 * @param locator The queried package
82 * @param binaryName The name of the binary file to execute
83 * @param args The arguments to pass to the file
84 */
85export declare function executePackageAccessibleBinary(locator: Locator, binaryName: string, args: Array<string>, { cwd, project, stdin, stdout, stderr, nodeArgs }: ExecutePackageAccessibleBinaryOptions): Promise<number>;
86declare type ExecuteWorkspaceAccessibleBinaryOptions = {
87 cwd: PortablePath;
88 stdin: Readable | null;
89 stdout: Writable;
90 stderr: Writable;
91};
92/**
93 * Execute a binary from the specified workspace
94 *
95 * @param workspace The queried package
96 * @param binaryName The name of the binary file to execute
97 * @param args The arguments to pass to the file
98 */
99export declare function executeWorkspaceAccessibleBinary(workspace: Workspace, binaryName: string, args: Array<string>, { cwd, stdin, stdout, stderr }: ExecuteWorkspaceAccessibleBinaryOptions): Promise<number>;
100export {};