UNPKG

2.57 kBTypeScriptView Raw
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 */
8import { JsonValue, Path, PathFragment, virtualFs } from '@angular-devkit/core';
9import { Action } from './action';
10import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
11export declare class HostDirEntry implements DirEntry {
12 readonly parent: DirEntry | null;
13 readonly path: Path;
14 protected _host: virtualFs.SyncDelegateHost;
15 protected _tree: Tree;
16 constructor(parent: DirEntry | null, path: Path, _host: virtualFs.SyncDelegateHost, _tree: Tree);
17 get subdirs(): PathFragment[];
18 get subfiles(): PathFragment[];
19 dir(name: PathFragment): DirEntry;
20 file(name: PathFragment): FileEntry | null;
21 visit(visitor: FileVisitor): void;
22 private getSubfilesRecursively;
23}
24export declare class HostTree implements Tree {
25 protected _backend: virtualFs.ReadonlyHost<{}>;
26 private readonly _id;
27 private _record;
28 private _recordSync;
29 private _ancestry;
30 private _dirCache;
31 static isHostTree(tree: Tree): tree is HostTree;
32 constructor(_backend?: virtualFs.ReadonlyHost<{}>);
33 protected _normalizePath(path: string): Path;
34 protected _willCreate(path: Path): boolean;
35 protected _willOverwrite(path: Path): boolean;
36 protected _willDelete(path: Path): boolean;
37 protected _willRename(path: Path): boolean;
38 branch(): Tree;
39 private isAncestorOf;
40 merge(other: Tree, strategy?: MergeStrategy): void;
41 get root(): DirEntry;
42 read(path: string): Buffer | null;
43 readText(path: string): string;
44 readJson(path: string): JsonValue;
45 exists(path: string): boolean;
46 get(path: string): FileEntry | null;
47 getDir(path: string): DirEntry;
48 visit(visitor: FileVisitor): void;
49 overwrite(path: string, content: Buffer | string): void;
50 beginUpdate(path: string): UpdateRecorder;
51 commitUpdate(record: UpdateRecorder): void;
52 create(path: string, content: Buffer | string): void;
53 delete(path: string): void;
54 rename(from: string, to: string): void;
55 apply(action: Action, strategy?: MergeStrategy): void;
56 private generateActions;
57 get actions(): Action[];
58}
59export declare class HostCreateTree extends HostTree {
60 constructor(host: virtualFs.ReadonlyHost);
61}
62export declare class FilterHostTree extends HostTree {
63 constructor(tree: HostTree, filter?: FilePredicate<boolean>);
64}