node-modules-architect-host.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 { json, workspaces } from '@angular-devkit/core';
  9. import { BuilderInfo } from '../src';
  10. import { Target } from '../src/input-schema';
  11. import { ArchitectHost, Builder } from '../src/internal';
  12. export type NodeModulesBuilderInfo = BuilderInfo & {
  13. import: string;
  14. };
  15. export interface WorkspaceHost {
  16. getBuilderName(project: string, target: string): Promise<string>;
  17. getMetadata(project: string): Promise<json.JsonObject>;
  18. getOptions(project: string, target: string, configuration?: string): Promise<json.JsonObject>;
  19. hasTarget(project: string, target: string): Promise<boolean>;
  20. getDefaultConfigurationName(project: string, target: string): Promise<string | undefined>;
  21. }
  22. export declare class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {
  23. protected _root: string;
  24. private workspaceHost;
  25. constructor(workspaceHost: WorkspaceHost, _root: string);
  26. constructor(workspace: workspaces.WorkspaceDefinition, _root: string);
  27. getBuilderNameForTarget(target: Target): Promise<string>;
  28. /**
  29. * Resolve a builder. This needs to be a string which will be used in a dynamic `import()`
  30. * clause. This should throw if no builder can be found. The dynamic import will throw if
  31. * it is unsupported.
  32. * @param builderStr The name of the builder to be used.
  33. * @returns All the info needed for the builder itself.
  34. */
  35. resolveBuilder(builderStr: string): Promise<NodeModulesBuilderInfo>;
  36. getCurrentDirectory(): Promise<string>;
  37. getWorkspaceRoot(): Promise<string>;
  38. getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
  39. getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
  40. loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder>;
  41. }