1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /// <amd-module name="@angular/compiler-cli/ngcc/src/execution/cluster/api" />
|
---|
9 | import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
|
---|
10 | import { JsonObject } from '../../packages/entry_point';
|
---|
11 | import { PackageJsonChange } from '../../writing/package_json_updater';
|
---|
12 | import { Task, TaskProcessingOutcome } from '../tasks/api';
|
---|
13 | /** A message reporting that an unrecoverable error occurred. */
|
---|
14 | export interface ErrorMessage extends JsonObject {
|
---|
15 | type: 'error';
|
---|
16 | error: string;
|
---|
17 | }
|
---|
18 | /** A message requesting the processing of a task. */
|
---|
19 | export interface ProcessTaskMessage extends JsonObject {
|
---|
20 | type: 'process-task';
|
---|
21 | task: Task;
|
---|
22 | }
|
---|
23 | /**
|
---|
24 | * A message reporting the result of processing the currently assigned task.
|
---|
25 | *
|
---|
26 | * NOTE: To avoid the communication overhead, the task is not included in the message. Instead, the
|
---|
27 | * master is responsible for keeping a mapping of workers to their currently assigned tasks.
|
---|
28 | */
|
---|
29 | export interface TaskCompletedMessage extends JsonObject {
|
---|
30 | type: 'task-completed';
|
---|
31 | outcome: TaskProcessingOutcome;
|
---|
32 | message: string | null;
|
---|
33 | }
|
---|
34 | /** A message listing the paths to transformed files about to be written to disk. */
|
---|
35 | export interface TransformedFilesMessage extends JsonObject {
|
---|
36 | type: 'transformed-files';
|
---|
37 | files: AbsoluteFsPath[];
|
---|
38 | }
|
---|
39 | /** A message requesting the update of a `package.json` file. */
|
---|
40 | export interface UpdatePackageJsonMessage extends JsonObject {
|
---|
41 | type: 'update-package-json';
|
---|
42 | packageJsonPath: AbsoluteFsPath;
|
---|
43 | changes: PackageJsonChange[];
|
---|
44 | }
|
---|
45 | /** The type of messages sent from cluster workers to the cluster master. */
|
---|
46 | export declare type MessageFromWorker = ErrorMessage | TaskCompletedMessage | TransformedFilesMessage | UpdatePackageJsonMessage;
|
---|
47 | /** The type of messages sent from the cluster master to cluster workers. */
|
---|
48 | export declare type MessageToWorker = ProcessTaskMessage;
|
---|