UNPKG

4.11 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 { BaseException } from '@angular-devkit/core';
9import { Observable } from 'rxjs';
10import { Url } from 'url';
11import { RuleFactory, Source, TaskExecutor, TaskExecutorFactory } from '../src';
12import { FileSystemCollectionDesc, FileSystemEngineHost, FileSystemSchematicContext, FileSystemSchematicDesc, FileSystemSchematicDescription } from './description';
13export declare type OptionTransform<T extends object | null, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R;
14export declare type ContextTransform = (context: FileSystemSchematicContext) => FileSystemSchematicContext;
15export declare class CollectionCannotBeResolvedException extends BaseException {
16 constructor(name: string);
17}
18export declare class InvalidCollectionJsonException extends BaseException {
19 constructor(_name: string, path: string, jsonException?: Error);
20}
21export declare class SchematicMissingFactoryException extends BaseException {
22 constructor(name: string);
23}
24export declare class FactoryCannotBeResolvedException extends BaseException {
25 constructor(name: string);
26}
27export declare class CollectionMissingSchematicsMapException extends BaseException {
28 constructor(name: string);
29}
30export declare class CollectionMissingFieldsException extends BaseException {
31 constructor(name: string);
32}
33export declare class SchematicMissingFieldsException extends BaseException {
34 constructor(name: string);
35}
36export declare class SchematicMissingDescriptionException extends BaseException {
37 constructor(name: string);
38}
39export declare class SchematicNameCollisionException extends BaseException {
40 constructor(name: string);
41}
42/**
43 * A EngineHost base class that uses the file system to resolve collections. This is the base of
44 * all other EngineHost provided by the tooling part of the Schematics library.
45 */
46export declare abstract class FileSystemEngineHostBase implements FileSystemEngineHost {
47 protected abstract _resolveCollectionPath(name: string, requester?: string): string;
48 protected abstract _resolveReferenceString(name: string, parentPath: string, collectionDescription: FileSystemCollectionDesc): {
49 ref: RuleFactory<{}>;
50 path: string;
51 } | null;
52 protected abstract _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc;
53 protected abstract _transformSchematicDescription(name: string, collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc;
54 private _transforms;
55 private _contextTransforms;
56 private _taskFactories;
57 listSchematicNames(collection: FileSystemCollectionDesc, includeHidden?: boolean): string[];
58 registerOptionsTransform<T extends object | null, R extends object>(t: OptionTransform<T, R>): void;
59 registerContextTransform(t: ContextTransform): void;
60 /**
61 *
62 * @param name
63 * @return {{path: string}}
64 */
65 createCollectionDescription(name: string, requester?: FileSystemCollectionDesc): FileSystemCollectionDesc;
66 createSchematicDescription(name: string, collection: FileSystemCollectionDesc): FileSystemSchematicDesc | null;
67 createSourceFromUrl(url: Url): Source | null;
68 transformOptions<OptionT extends object, ResultT extends object>(schematic: FileSystemSchematicDesc, options: OptionT, context?: FileSystemSchematicContext): Observable<ResultT>;
69 transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext;
70 getSchematicRuleFactory<OptionT extends object>(schematic: FileSystemSchematicDesc, _collection: FileSystemCollectionDesc): RuleFactory<OptionT>;
71 registerTaskExecutor<T>(factory: TaskExecutorFactory<T>, options?: T): void;
72 createTaskExecutor(name: string): Observable<TaskExecutor>;
73 hasTaskExecutor(name: string): boolean;
74}