UNPKG

2.65 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.dev/license
7 */
8import { Observable } from 'rxjs';
9import { Path, PathFragment } from '../path';
10import { FileBuffer, Host, HostCapabilities, HostWatchEvent, HostWatchEventType, HostWatchOptions, Stats } from './interface';
11export interface SimpleMemoryHostStats {
12 readonly content: FileBuffer | null;
13}
14export declare class SimpleMemoryHost implements Host<{}> {
15 protected _cache: Map<Path, Stats<SimpleMemoryHostStats>>;
16 private _watchers;
17 protected _newDirStats(): {
18 inspect(): string;
19 isFile(): boolean;
20 isDirectory(): boolean;
21 size: number;
22 atime: Date;
23 ctime: Date;
24 mtime: Date;
25 birthtime: Date;
26 content: null;
27 };
28 protected _newFileStats(content: FileBuffer, oldStats?: Stats<SimpleMemoryHostStats>): {
29 inspect(): string;
30 isFile(): boolean;
31 isDirectory(): boolean;
32 size: number;
33 atime: Date;
34 ctime: Date;
35 mtime: Date;
36 birthtime: Date;
37 content: ArrayBuffer;
38 };
39 constructor();
40 protected _toAbsolute(path: Path): Path;
41 protected _updateWatchers(path: Path, type: HostWatchEventType): void;
42 get capabilities(): HostCapabilities;
43 /**
44 * List of protected methods that give direct access outside the observables to the cache
45 * and internal states.
46 */
47 protected _write(path: Path, content: FileBuffer): void;
48 protected _read(path: Path): FileBuffer;
49 protected _delete(path: Path): void;
50 protected _rename(from: Path, to: Path): void;
51 protected _list(path: Path): PathFragment[];
52 protected _exists(path: Path): boolean;
53 protected _isDirectory(path: Path): boolean;
54 protected _isFile(path: Path): boolean;
55 protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null;
56 protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>;
57 write(path: Path, content: FileBuffer): Observable<void>;
58 read(path: Path): Observable<FileBuffer>;
59 delete(path: Path): Observable<void>;
60 rename(from: Path, to: Path): Observable<void>;
61 list(path: Path): Observable<PathFragment[]>;
62 exists(path: Path): Observable<boolean>;
63 isDirectory(path: Path): Observable<boolean>;
64 isFile(path: Path): Observable<boolean>;
65 stat(path: Path): Observable<Stats<{}> | null> | null;
66 watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent> | null;
67 reset(): void;
68}