fallback-engine-host.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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.dev/license
  7. */
  8. import { Url } from 'node:url';
  9. import { Observable } from 'rxjs';
  10. import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src';
  11. export type FallbackCollectionDescription = {
  12. host: EngineHost<{}, {}>;
  13. description: CollectionDescription<{}>;
  14. };
  15. export type FallbackSchematicDescription = {
  16. description: SchematicDescription<{}, {}>;
  17. };
  18. export type FallbackContext = TypedSchematicContext<FallbackCollectionDescription, FallbackSchematicDescription>;
  19. /**
  20. * An EngineHost that support multiple hosts in a fallback configuration. If a host does not
  21. * have a collection/schematics, use the following host before giving up.
  22. */
  23. export declare class FallbackEngineHost implements EngineHost<{}, {}> {
  24. private _hosts;
  25. addHost<CollectionT extends object, SchematicT extends object>(host: EngineHost<CollectionT, SchematicT>): void;
  26. createCollectionDescription(name: string, requester?: CollectionDescription<{}>): CollectionDescription<FallbackCollectionDescription>;
  27. createSchematicDescription(name: string, collection: CollectionDescription<FallbackCollectionDescription>): SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription> | null;
  28. getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, collection: CollectionDescription<FallbackCollectionDescription>): RuleFactory<OptionT>;
  29. createSourceFromUrl(url: Url, context: FallbackContext): Source | null;
  30. transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, options: OptionT, context?: FallbackContext): Observable<ResultT>;
  31. transformContext(context: FallbackContext): FallbackContext;
  32. listSchematicNames(collection: CollectionDescription<FallbackCollectionDescription>, includeHidden?: boolean): string[];
  33. createTaskExecutor(name: string): Observable<TaskExecutor>;
  34. hasTaskExecutor(name: string): boolean;
  35. }