MCPcopy
hub / github.com/angular/angular-cli / NullTree

Class NullTree

packages/angular_devkit/schematics/src/tree/null.ts:58–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
58export class NullTree implements Tree {
59 constructor() {
60 this[TreeSymbol] = () => this;
61 }
62
63 branch(): Tree {
64 return new NullTree();
65 }
66 merge(_other: Tree, _strategy?: MergeStrategy): void {}
67
68 readonly root: DirEntry = new NullTreeDirEntry(normalize('/'));
69
70 // Simple readonly file system operations.
71 exists(_path: string) {
72 return false;
73 }
74 read(_path: string) {
75 return null;
76 }
77 readText(path: string): string {
78 throw new FileDoesNotExistException(path);
79 }
80 readJson(path: string): JsonValue {
81 throw new FileDoesNotExistException(path);
82 }
83 get(_path: string) {
84 return null;
85 }
86 getDir(path: string): NullTreeDirEntry {
87 return new NullTreeDirEntry(normalize('/' + path));
88 }
89 visit(): void {}
90
91 // Change content of host files.
92 beginUpdate(path: string): never {
93 throw new FileDoesNotExistException(path);
94 }
95 commitUpdate(record: UpdateRecorder): never {
96 throw new FileDoesNotExistException(
97 record instanceof UpdateRecorderBase ? record.path : '<unknown>',
98 );
99 }
100
101 // Change structure of the host.
102 copy(path: string, _to: string): never {
103 throw new FileDoesNotExistException(path);
104 }
105 delete(path: string): never {
106 throw new FileDoesNotExistException(path);
107 }
108 create(path: string, _content: Buffer | string): never {
109 throw new CannotCreateFileException(path);
110 }
111 rename(path: string, _to: string): never {
112 throw new FileDoesNotExistException(path);
113 }
114 overwrite(path: string, _content: Buffer | string): never {
115 throw new FileDoesNotExistException(path);

Callers

nothing calls this directly

Calls 1

normalizeFunction · 0.90

Tested by

no test coverage detected