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