UNPKG

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