UNPKG

2.03 kBTypeScriptView Raw
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 */
8import { json } from '@angular-devkit/core';
9import { BuilderInfo, Target } from '../src';
10import { ArchitectHost, Builder } from '../src/internal';
11export declare class TestingArchitectHost implements ArchitectHost {
12 workspaceRoot: string;
13 currentDirectory: string;
14 private _backendHost;
15 private _builderImportMap;
16 private _builderMap;
17 private _targetMap;
18 /**
19 * Can provide a backend host, in case of integration tests.
20 * @param workspaceRoot The workspace root to use.
21 * @param currentDirectory The current directory to use.
22 * @param _backendHost A host to defer calls that aren't resolved here.
23 */
24 constructor(workspaceRoot?: string, currentDirectory?: string, _backendHost?: ArchitectHost | null);
25 addBuilder(builderName: string, builder: Builder, description?: string, optionSchema?: json.schema.JsonSchema): void;
26 addBuilderFromPackage(packageName: string): Promise<void>;
27 addTarget(target: Target, builderName: string, options?: json.JsonObject): void;
28 getBuilderNameForTarget(target: Target): Promise<string | null>;
29 /**
30 * Resolve a builder. This needs to return a string which will be used in a dynamic `import()`
31 * clause. This should throw if no builder can be found. The dynamic import will throw if
32 * it is unsupported.
33 * @param builderName The name of the builder to be used.
34 * @returns All the info needed for the builder itself.
35 */
36 resolveBuilder(builderName: string): Promise<BuilderInfo | null>;
37 getCurrentDirectory(): Promise<string>;
38 getWorkspaceRoot(): Promise<string>;
39 getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
40 getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
41 loadBuilder(info: BuilderInfo): Promise<Builder | null>;
42}