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, ScssUseChanges } from './schema'; import { ServerHost } from './ServerHost'; import { SassStylesheet } from './sass/stylesheet'; import { SassChangeResult } from './sass/changes'; export declare enum InputPropertyType { EVAL = "eval", STRING = "string" } /** One configured Sass change, and the text a stylesheet mentions when the change can apply to it. */ interface SassStep { mention: string; apply: (sheet: SassStylesheet) => SassChangeResult; } 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 scssUseChanges: ScssUseChanges; /** Sass changes that could not be made automatically, as `path:line - what to do`. */ protected manualSassChanges: Set; protected membersChanges: MemberChanges; protected conditionFunctions: Map any>; protected valueTransforms: Map; 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[]; /** Collects the Sass files under a folder, skipping dependency and build output folders. */ private collectSassFiles; 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; /** * Every configured Sass change, in the order it is applied to each stylesheet: theme * properties, variables, functions and mixins, then module rules. Each names the text a * stylesheet has to mention for the change to apply, so that most stylesheets are skipped quickly. */ protected sassChanges(): SassStep[]; /** * Applies Sass changes to a stylesheet one after another, each on the stylesheet the previous * one left. What a change leaves for manual review is reported at its line in the final * stylesheet, after every later change. */ private updateStylesheet; protected updateImports(entryPath: string): void; protected updateClassMembers(entryPath: string, memberChanges: MemberChanges): void; private patchTsConfig; private ensureTsConfigPath; private loadConfig; private areConditionsFulfilled; private copyPropertyValueBetweenElementTags; private sourceDirsVisitor; 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 {};