[6a3a178] | 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 | import { experimental, json } from '@angular-devkit/core';
|
---|
| 9 | import { BuilderInfo, BuilderInput, BuilderOutput, Target } from './api';
|
---|
| 10 | /**
|
---|
| 11 | * BuilderSymbol used for knowing if a function was created using createBuilder(). This is a
|
---|
| 12 | * property set on the function that should be `true`.
|
---|
| 13 | * Using Symbol.for() as it's a global registry that's the same for all installations of
|
---|
| 14 | * Architect (if some libraries depends directly on architect instead of sharing the files).
|
---|
| 15 | */
|
---|
| 16 | export declare const BuilderSymbol: unique symbol;
|
---|
| 17 | /**
|
---|
| 18 | * BuilderVersionSymbol used for knowing which version of the library createBuilder() came from.
|
---|
| 19 | * This is to make sure we don't try to use an incompatible builder.
|
---|
| 20 | * Using Symbol.for() as it's a global registry that's the same for all installations of
|
---|
| 21 | * Architect (if some libraries depends directly on architect instead of sharing the files).
|
---|
| 22 | */
|
---|
| 23 | export declare const BuilderVersionSymbol: unique symbol;
|
---|
| 24 | /**
|
---|
| 25 | * A Specialization of the JobHandler type. This exposes BuilderDescription as the job description
|
---|
| 26 | * type.
|
---|
| 27 | */
|
---|
| 28 | export declare type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> = experimental.jobs.JobHandler<A, I, O> & {
|
---|
| 29 | jobDescription: BuilderDescription;
|
---|
| 30 | };
|
---|
| 31 | /**
|
---|
| 32 | * A Builder description, which is used internally. Adds the builder info which is the
|
---|
| 33 | * metadata attached to a builder in Architect.
|
---|
| 34 | */
|
---|
| 35 | export interface BuilderDescription extends experimental.jobs.JobDescription {
|
---|
| 36 | info: BuilderInfo;
|
---|
| 37 | }
|
---|
| 38 | /**
|
---|
| 39 | * A Builder instance. Use createBuilder() to create one of these.
|
---|
| 40 | */
|
---|
| 41 | export interface Builder<OptionT extends json.JsonObject = json.JsonObject> {
|
---|
| 42 | handler: experimental.jobs.JobHandler<json.JsonObject, BuilderInput, BuilderOutput>;
|
---|
| 43 | [BuilderSymbol]: true;
|
---|
| 44 | [BuilderVersionSymbol]: string;
|
---|
| 45 | }
|
---|
| 46 | export interface ArchitectHost<BuilderInfoT extends BuilderInfo = BuilderInfo> {
|
---|
| 47 | /**
|
---|
| 48 | * Get the builder name for a target.
|
---|
| 49 | * @param target The target to inspect.
|
---|
| 50 | */
|
---|
| 51 | getBuilderNameForTarget(target: Target): Promise<string | null>;
|
---|
| 52 | /**
|
---|
| 53 | * Resolve a builder. This needs to return a string which will be used in a dynamic `import()`
|
---|
| 54 | * clause. This should throw if no builder can be found. The dynamic import will throw if
|
---|
| 55 | * it is unsupported.
|
---|
| 56 | * @param builderName The name of the builder to be used.
|
---|
| 57 | * @returns All the info needed for the builder itself.
|
---|
| 58 | */
|
---|
| 59 | resolveBuilder(builderName: string): Promise<BuilderInfoT | null>;
|
---|
| 60 | loadBuilder(info: BuilderInfoT): Promise<Builder | null>;
|
---|
| 61 | getCurrentDirectory(): Promise<string>;
|
---|
| 62 | getWorkspaceRoot(): Promise<string>;
|
---|
| 63 | getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
|
---|
| 64 | getProjectMetadata(projectName: string): Promise<json.JsonObject | null>;
|
---|
| 65 | getProjectMetadata(target: Target): Promise<json.JsonObject | null>;
|
---|
| 66 | }
|
---|