igniteui-angular
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
106 lines (105 loc) • 4.54 kB
TypeScript
import * as ts from 'typescript';
import * as tss from 'typescript/lib/tsserverlibrary';
import type { SchematicContext, Tree } from '@angular-devkit/schematics';
import type { WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
import { ClassChanges, BindingChanges, SelectorChange, SelectorChanges, ThemeChanges, ImportsChanges, MemberChanges, ThemeChange } from './schema';
import { ServerHost } from './ServerHost';
export declare enum InputPropertyType {
EVAL = "eval",
STRING = "string"
}
declare type TransformFunction = (args: BoundPropertyObject) => void;
export interface BoundPropertyObject {
value: string;
bindingType: InputPropertyType;
}
export declare class UpdateChanges {
private rootPath;
private host;
private context?;
protected tsconfigPath: string;
_shouldInvokeLS: boolean;
get shouldInvokeLS(): boolean;
set shouldInvokeLS(val: boolean);
get projectService(): tss.server.ProjectService;
protected get serverHost(): ServerHost;
protected workspace: WorkspaceSchema;
protected sourcePaths: string[];
protected classChanges: ClassChanges;
protected outputChanges: BindingChanges;
protected inputChanges: BindingChanges;
protected selectorChanges: SelectorChanges;
protected themeChanges: ThemeChanges;
protected importsChanges: ImportsChanges;
protected membersChanges: MemberChanges;
protected conditionFunctions: Map<string, (...args: any[]) => any>;
protected valueTransforms: Map<string, TransformFunction>;
private _templateFiles;
private _initialTsConfig;
get templateFiles(): string[];
private _tsFiles;
get tsFiles(): string[];
private _sassFiles;
/** Sass (both .scss and .sass) files in the project being updated. */
get sassFiles(): string[];
private _service;
get service(): ts.LanguageService;
private _packageManager;
private get packageManager();
/**
* Create a new base schematic to apply changes
*
* @param rootPath Root folder for the schematic to read configs, pass __dirname
*/
constructor(rootPath: string, host: Tree, context?: SchematicContext);
/** Apply configured changes to the Host Tree */
applyChanges(): void;
/** Add condition function. */
addCondition(conditionName: string, callback: (ownerMatch: string, path: string) => boolean): void;
addValueTransform(functionName: string, callback: TransformFunction): void;
/** Path must be absolute. If calling externally, use this.getAbsolutePath */
protected getDefaultLanguageService(entryPath: string): tss.LanguageService | undefined;
protected updateSelectors(entryPath: string): void;
protected applySelectorChange(fileContent: string, change: SelectorChange): string;
protected updateClasses(entryPath: string): void;
protected updateBindings(entryPath: string, bindChanges: BindingChanges, type?: BindingType): void;
protected updateThemeProps(entryPath: string): void;
protected isNamedArgument(fileContent: string, i: number, occurrences: number[], change: ThemeChange): boolean;
protected updateSassVariables(entryPath: string): void;
protected updateSassFunctionsAndMixins(entryPath: string): void;
protected getAliases(entryPath: string): any[];
protected updateImports(entryPath: string): void;
protected updateClassMembers(entryPath: string, memberChanges: MemberChanges): void;
private tryReplaceScssFunctionWithAlias;
private tryReplaceScssFunction;
private patchTsConfig;
private ensureTsConfigPath;
private loadConfig;
private areConditionsFulfilled;
private copyPropertyValueBetweenElementTags;
private sourceDirsVisitor;
/**
* Safe split by `','`, considering possible inner function calls. E.g.:
* ```
* prop: inner-func(),
* prop2: inner2(inner-param: 3, inner-param: inner-func(..))
* ```
*/
private splitFunctionProps;
private updateTemplateFiles;
private updateTsFiles;
private updateMembers;
private getDefaultProjectForFile;
/**
* Force Angular service to compile project on initial load w/ configured project
* otherwise if the first compilation occurs on an HTML file the project won't have proper refs
* and no actual angular metadata will be resolved for the rest of the migration
*/
private configureForAngularLS;
private getWorkspaceProjectEntryPath;
}
export declare enum BindingType {
Output = 0,
Input = 1
}
export {};