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 | /// <amd-module name="@angular/compiler-cli/src/ngtsc/file_system/testing/src/mock_file_system" />
|
---|
9 | import { AbsoluteFsPath, FileStats, FileSystem, PathSegment, PathString } from '../../src/types';
|
---|
10 | /**
|
---|
11 | * An in-memory file system that can be used in unit tests.
|
---|
12 | */
|
---|
13 | export declare abstract class MockFileSystem implements FileSystem {
|
---|
14 | private _isCaseSensitive;
|
---|
15 | private _fileTree;
|
---|
16 | private _cwd;
|
---|
17 | constructor(_isCaseSensitive?: boolean, cwd?: AbsoluteFsPath);
|
---|
18 | isCaseSensitive(): boolean;
|
---|
19 | exists(path: AbsoluteFsPath): boolean;
|
---|
20 | readFile(path: AbsoluteFsPath): string;
|
---|
21 | readFileBuffer(path: AbsoluteFsPath): Uint8Array;
|
---|
22 | writeFile(path: AbsoluteFsPath, data: string | Uint8Array, exclusive?: boolean): void;
|
---|
23 | removeFile(path: AbsoluteFsPath): void;
|
---|
24 | symlink(target: AbsoluteFsPath, path: AbsoluteFsPath): void;
|
---|
25 | readdir(path: AbsoluteFsPath): PathSegment[];
|
---|
26 | lstat(path: AbsoluteFsPath): FileStats;
|
---|
27 | stat(path: AbsoluteFsPath): FileStats;
|
---|
28 | copyFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void;
|
---|
29 | moveFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void;
|
---|
30 | ensureDir(path: AbsoluteFsPath): Folder;
|
---|
31 | removeDeep(path: AbsoluteFsPath): void;
|
---|
32 | isRoot(path: AbsoluteFsPath): boolean;
|
---|
33 | extname(path: AbsoluteFsPath | PathSegment): string;
|
---|
34 | realpath(filePath: AbsoluteFsPath): AbsoluteFsPath;
|
---|
35 | pwd(): AbsoluteFsPath;
|
---|
36 | chdir(path: AbsoluteFsPath): void;
|
---|
37 | getDefaultLibLocation(): AbsoluteFsPath;
|
---|
38 | abstract resolve(...paths: string[]): AbsoluteFsPath;
|
---|
39 | abstract dirname<T extends string>(file: T): T;
|
---|
40 | abstract join<T extends string>(basePath: T, ...paths: string[]): T;
|
---|
41 | abstract relative<T extends PathString>(from: T, to: T): PathSegment | AbsoluteFsPath;
|
---|
42 | abstract basename(filePath: string, extension?: string): PathSegment;
|
---|
43 | abstract isRooted(path: string): boolean;
|
---|
44 | abstract normalize<T extends PathString>(path: T): T;
|
---|
45 | protected abstract splitPath<T extends PathString>(path: T): string[];
|
---|
46 | dump(): Folder;
|
---|
47 | init(folder: Folder): void;
|
---|
48 | mount(path: AbsoluteFsPath, folder: Folder): void;
|
---|
49 | private cloneFolder;
|
---|
50 | private copyInto;
|
---|
51 | protected findFromPath(path: AbsoluteFsPath, options?: {
|
---|
52 | followSymLinks: boolean;
|
---|
53 | }): FindResult;
|
---|
54 | protected splitIntoFolderAndFile(path: AbsoluteFsPath): [AbsoluteFsPath, string];
|
---|
55 | protected getCanonicalPath<T extends string>(p: T): T;
|
---|
56 | }
|
---|
57 | export interface FindResult {
|
---|
58 | path: AbsoluteFsPath;
|
---|
59 | entity: Entity | null;
|
---|
60 | }
|
---|
61 | export declare type Entity = Folder | File | SymLink;
|
---|
62 | export interface Folder {
|
---|
63 | [pathSegments: string]: Entity;
|
---|
64 | }
|
---|
65 | export declare type File = string | Uint8Array;
|
---|
66 | export declare class SymLink {
|
---|
67 | path: AbsoluteFsPath;
|
---|
68 | constructor(path: AbsoluteFsPath);
|
---|
69 | }
|
---|
70 | export declare function isFile(item: Entity | null): item is File;
|
---|
71 | export declare function isSymLink(item: Entity | null): item is SymLink;
|
---|
72 | export declare function isFolder(item: Entity | null): item is Folder;
|
---|