[6a3a178] | 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 { UpdateRecorder } from '@angular-devkit/schematics';
|
---|
| 9 | export interface Host {
|
---|
| 10 | write(path: string, content: string): Promise<void>;
|
---|
| 11 | read(path: string): Promise<string>;
|
---|
| 12 | }
|
---|
| 13 | export interface Change {
|
---|
| 14 | apply(host: Host): Promise<void>;
|
---|
| 15 | readonly path: string | null;
|
---|
| 16 | readonly order: number;
|
---|
| 17 | readonly description: string;
|
---|
| 18 | }
|
---|
| 19 | /**
|
---|
| 20 | * An operation that does nothing.
|
---|
| 21 | */
|
---|
| 22 | export declare class NoopChange implements Change {
|
---|
| 23 | description: string;
|
---|
| 24 | order: number;
|
---|
| 25 | path: null;
|
---|
| 26 | apply(): Promise<void>;
|
---|
| 27 | }
|
---|
| 28 | /**
|
---|
| 29 | * Will add text to the source code.
|
---|
| 30 | */
|
---|
| 31 | export declare class InsertChange implements Change {
|
---|
| 32 | path: string;
|
---|
| 33 | pos: number;
|
---|
| 34 | toAdd: string;
|
---|
| 35 | order: number;
|
---|
| 36 | description: string;
|
---|
| 37 | constructor(path: string, pos: number, toAdd: string);
|
---|
| 38 | /**
|
---|
| 39 | * This method does not insert spaces if there is none in the original string.
|
---|
| 40 | */
|
---|
| 41 | apply(host: Host): Promise<void>;
|
---|
| 42 | }
|
---|
| 43 | /**
|
---|
| 44 | * Will remove text from the source code.
|
---|
| 45 | */
|
---|
| 46 | export declare class RemoveChange implements Change {
|
---|
| 47 | path: string;
|
---|
| 48 | private pos;
|
---|
| 49 | toRemove: string;
|
---|
| 50 | order: number;
|
---|
| 51 | description: string;
|
---|
| 52 | constructor(path: string, pos: number, toRemove: string);
|
---|
| 53 | apply(host: Host): Promise<void>;
|
---|
| 54 | }
|
---|
| 55 | /**
|
---|
| 56 | * Will replace text from the source code.
|
---|
| 57 | */
|
---|
| 58 | export declare class ReplaceChange implements Change {
|
---|
| 59 | path: string;
|
---|
| 60 | private pos;
|
---|
| 61 | oldText: string;
|
---|
| 62 | newText: string;
|
---|
| 63 | order: number;
|
---|
| 64 | description: string;
|
---|
| 65 | constructor(path: string, pos: number, oldText: string, newText: string);
|
---|
| 66 | apply(host: Host): Promise<void>;
|
---|
| 67 | }
|
---|
| 68 | export declare function applyToUpdateRecorder(recorder: UpdateRecorder, changes: Change[]): void;
|
---|