1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import { JsonValue, Path, PathFragment } from '@angular-devkit/core';
|
10 | import { Action } from './action';
|
11 | export declare enum MergeStrategy {
|
12 | AllowOverwriteConflict = 2,
|
13 | AllowCreationConflict = 4,
|
14 | AllowDeleteConflict = 8,
|
15 | Default = 0,
|
16 | Error = 1,
|
17 | ContentOnly = 2,
|
18 | Overwrite = 14
|
19 | }
|
20 | export declare const FileVisitorCancelToken: symbol;
|
21 | export declare type FileVisitor = FilePredicate<void>;
|
22 | export interface FileEntry {
|
23 | readonly path: Path;
|
24 | readonly content: Buffer;
|
25 | }
|
26 | export interface DirEntry {
|
27 | readonly parent: DirEntry | null;
|
28 | readonly path: Path;
|
29 | readonly subdirs: PathFragment[];
|
30 | readonly subfiles: PathFragment[];
|
31 | dir(name: PathFragment): DirEntry;
|
32 | file(name: PathFragment): FileEntry | null;
|
33 | visit(visitor: FileVisitor): void;
|
34 | }
|
35 | export interface FilePredicate<T> {
|
36 | (path: Path, entry?: Readonly<FileEntry> | null): T;
|
37 | }
|
38 | export declare const TreeSymbol: symbol;
|
39 | export interface Tree {
|
40 | branch(): Tree;
|
41 | merge(other: Tree, strategy?: MergeStrategy): void;
|
42 | readonly root: DirEntry;
|
43 | read(path: string): Buffer | null;
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | readText(path: string): string;
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | readJson(path: string): JsonValue;
|
66 | exists(path: string): boolean;
|
67 | get(path: string): FileEntry | null;
|
68 | getDir(path: string): DirEntry;
|
69 | visit(visitor: FileVisitor): void;
|
70 | overwrite(path: string, content: Buffer | string): void;
|
71 | beginUpdate(path: string): UpdateRecorder;
|
72 | commitUpdate(record: UpdateRecorder): void;
|
73 | create(path: string, content: Buffer | string): void;
|
74 | delete(path: string): void;
|
75 | rename(from: string, to: string): void;
|
76 | apply(action: Action, strategy?: MergeStrategy): void;
|
77 | readonly actions: Action[];
|
78 | }
|
79 | export interface UpdateRecorder {
|
80 | insertLeft(index: number, content: Buffer | string): UpdateRecorder;
|
81 | insertRight(index: number, content: Buffer | string): UpdateRecorder;
|
82 | remove(index: number, length: number): UpdateRecorder;
|
83 | }
|