@nx/angular
Version:
104 lines • 5.69 kB
TypeScript
import { Tree } from '@nx/devkit';
import type * as ts from 'typescript';
type DecoratorName = 'Component' | 'Directive' | 'NgModule' | 'Pipe';
/**
* Check if the Component, Directive or Pipe is standalone
* @param tree The file system tree
* @param sourceFile TS Source File containing the token to check
* @param decoratorName The type of decorator to check (Component, Directive, Pipe)
*/
export declare function isStandalone(tree: Tree, sourceFile: ts.SourceFile, decoratorName: DecoratorName): boolean;
export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[];
export declare function removeFromNgModule(host: Tree, source: ts.SourceFile, modulePath: string, property: string): ts.SourceFile;
/**
* Add an import to a Standalone Component
* @param host Virtual Tree
* @param source TS Source File containing the Component
* @param componentPath The path to the Component
* @param symbolName The import to add to the Component
*/
export declare function addImportToComponent(host: Tree, source: ts.SourceFile, componentPath: string, symbolName: string): ts.SourceFile;
/**
* Add an import to a Standalone Directive
* @param host Virtual Tree
* @param source TS Source File containing the Directive
* @param directivePath The path to the Directive
* @param symbolName The import to add to the Directive
*/
export declare function addImportToDirective(host: Tree, source: ts.SourceFile, directivePath: string, symbolName: string): ts.SourceFile;
/**
* Add an import to a Standalone Pipe
* @param host Virtual Tree
* @param source TS Source File containing the Pipe
* @param pipePath The path to the Pipe
* @param symbolName The import to add to the Pipe
*/
export declare function addImportToPipe(host: Tree, source: ts.SourceFile, pipePath: string, symbolName: string): ts.SourceFile;
/**
* Add an import to an NgModule
* @param host Virtual Tree
* @param source TS Source File containing the NgModule
* @param modulePath The path to the NgModule
* @param symbolName The import to add to the NgModule
*/
export declare function addImportToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
export declare function addImportToTestBed(host: Tree, source: ts.SourceFile, specPath: string, symbolName: string): ts.SourceFile;
export declare function addDeclarationsToTestBed(host: Tree, source: ts.SourceFile, specPath: string, symbolName: string[]): ts.SourceFile;
export declare function replaceIntoToTestBed(host: Tree, source: ts.SourceFile, specPath: string, newSymbol: string, previousSymbol: string): ts.SourceFile;
export declare function getBootstrapComponent(source: ts.SourceFile, moduleClassName: string): string;
export declare function addRouteToNgModule(host: Tree, ngModulePath: string, source: ts.SourceFile, route: string): ts.SourceFile;
export declare function isNgStandaloneApp(tree: Tree, projectName: string): boolean;
/**
* Add a provider to bootstrapApplication call for Standalone Applications
* @param tree Virtual Tree
* @param filePath Path to the file containing the bootstrapApplication call
* @param providerToAdd Provider to add
*/
export declare function addProviderToBootstrapApplication(tree: Tree, filePath: string, providerToAdd: string): void;
/**
* Add a provider to appConfig for Standalone Applications
* NOTE: The appConfig must be marked with type ApplicationConfig and the providers must be declared as an array in the config
* @param tree Virtual Tree
* @param filePath Path to the file containing the bootstrapApplication call
* @param providerToAdd Provider to add
*/
export declare function addProviderToAppConfig(tree: Tree, filePath: string, providerToAdd: string): void;
/**
* Add a provider to an NgModule
* @param host Virtual Tree
* @param source TS Source File containing the NgModule
* @param modulePath Path to the NgModule
* @param symbolName The provider to add
*/
export declare function addProviderToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
/**
* Add a provider to a Standalone Component
* @param host Virtual Tree
* @param source TS Source File containing the Component
* @param componentPath Path to the Component
* @param symbolName The provider to add
*/
export declare function addProviderToComponent(host: Tree, source: ts.SourceFile, componentPath: string, symbolName: string): ts.SourceFile;
/**
* Add a view provider to a Standalone Component
* @param host Virtual Tree
* @param source TS Source File containing the Component
* @param componentPath Path to the Component
* @param symbolName The provider to add
*/
export declare function addViewProviderToComponent(host: Tree, source: ts.SourceFile, componentPath: string, symbolName: string): ts.SourceFile;
export declare function addDeclarationToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
export declare function addEntryComponents(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
export declare function readBootstrapInfo(host: Tree, app: string): {
moduleSpec: string;
modulePath: string;
mainPath: string;
moduleClassName: string;
moduleSource: ts.SourceFile;
bootstrapComponentClassName: string;
bootstrapComponentFileName: string;
};
export declare function getDecoratorPropertyValueNode(host: Tree, modulePath: string, identifier: string, property: string, module: string): ts.Node;
export declare function getTsSourceFile(host: Tree, path: string): ts.SourceFile;
export {};
//# sourceMappingURL=ast-utils.d.ts.map