igniteui-angular
Version: 
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
60 lines (59 loc) • 2.93 kB
TypeScript
import type { SchematicContext, Tree } from '@angular-devkit/schematics';
import type { WorkspaceSchema, WorkspaceProject } from '@schematics/angular/utility/workspace-models';
import type { Attribute, Element, HtmlParser, HtmlTagDefinition, Node } from '@angular/compiler';
export declare const getProjectPaths: (config: WorkspaceSchema) => string[];
export declare const getWorkspacePath: (host: Tree) => string;
export declare const getWorkspace: (host: Tree) => WorkspaceSchema;
export declare const getProjects: (config: WorkspaceSchema) => WorkspaceProject[];
export declare const escapeRegExp: (string: any) => any;
export declare const replaceMatch: (content: string, toReplace: string, replaceWith: string, index: number) => string;
export declare const supports: (name: string) => boolean;
export declare const getPackageManager: (host: Tree) => "yarn" | "npm";
export declare const canResolvePackage: (pkg: string) => boolean;
export declare const getPackageVersion: (pkg: string) => string;
export declare const tryInstallPackage: (context: SchematicContext, packageManager: string, pkg: string) => void;
export declare const tryUninstallPackage: (context: SchematicContext, packageManager: string, pkg: string) => void;
interface TagOffset {
    start: number;
    end: number;
}
export interface SourceOffset {
    startTag: TagOffset;
    endTag: TagOffset;
    file: {
        content: string;
        url: string;
    };
    node?: Element;
}
export declare class FileChange {
    position: number;
    text: string;
    replaceText: string;
    type: 'insert' | 'replace';
    constructor(position?: number, text?: string, replaceText?: string, type?: 'insert' | 'replace');
    apply(content: string): string;
}
/**
 * Parses an Angular template file/content and returns an array of the root nodes of the file.
 * TODO: Maybe make async and dynamically import the HtmlParser
 * @param host
 * @param filePath
 * @param encoding
 */
export declare const parseFile: (parser: HtmlParser, host: Tree, filePath: string, encoding?: BufferEncoding) => Node[];
export declare const findElementNodes: (root: Node[], tag: string | string[]) => Node[];
export declare const hasAttribute: (root: Element, attribute: string | string[]) => boolean;
export declare const getAttribute: (root: Element, attribute: string | string[]) => Attribute[];
export declare const getSourceOffset: (element: Element) => SourceOffset;
/**
 * Given an array of `Node` objects, flattens the ast tree to a single array.
 * De facto only `Element` type objects have children.
 *
 * @param list
 */
export declare const flatten: (list: Node[]) => Node[];
export declare const serializeNodes: (nodes: Node[], getHtmlTagDefinition: (tagName: string) => HtmlTagDefinition) => string[];
export declare const makeNgIf: (name: string, value: string) => boolean;
export declare const stringifyAttributes: (attributes: Attribute[]) => string;
export {};