UNPKG

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