1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.NullTree = exports.NullTreeDirEntry = exports.CannotCreateFileException = void 0;
|
11 | const core_1 = require("@angular-devkit/core");
|
12 | const exception_1 = require("../exception/exception");
|
13 | const interface_1 = require("./interface");
|
14 | const recorder_1 = require("./recorder");
|
15 | class CannotCreateFileException extends core_1.BaseException {
|
16 | constructor(path) {
|
17 | super(`Cannot create file "${path}".`);
|
18 | }
|
19 | }
|
20 | exports.CannotCreateFileException = CannotCreateFileException;
|
21 | class NullTreeDirEntry {
|
22 | constructor(path) {
|
23 | this.path = path;
|
24 | this.subdirs = [];
|
25 | this.subfiles = [];
|
26 | }
|
27 | get parent() {
|
28 | return this.path == '/' ? null : new NullTreeDirEntry((0, core_1.dirname)(this.path));
|
29 | }
|
30 | dir(name) {
|
31 | return new NullTreeDirEntry((0, core_1.join)(this.path, name));
|
32 | }
|
33 | file(_name) {
|
34 | return null;
|
35 | }
|
36 | visit() { }
|
37 | }
|
38 | exports.NullTreeDirEntry = NullTreeDirEntry;
|
39 | class NullTree {
|
40 | constructor() {
|
41 | this.root = new NullTreeDirEntry((0, core_1.normalize)('/'));
|
42 | }
|
43 | [interface_1.TreeSymbol]() {
|
44 | return this;
|
45 | }
|
46 | branch() {
|
47 | return new NullTree();
|
48 | }
|
49 | merge(_other, _strategy) { }
|
50 |
|
51 | exists(_path) {
|
52 | return false;
|
53 | }
|
54 | read(_path) {
|
55 | return null;
|
56 | }
|
57 | readText(path) {
|
58 | throw new exception_1.FileDoesNotExistException(path);
|
59 | }
|
60 | readJson(path) {
|
61 | throw new exception_1.FileDoesNotExistException(path);
|
62 | }
|
63 | get(_path) {
|
64 | return null;
|
65 | }
|
66 | getDir(path) {
|
67 | return new NullTreeDirEntry((0, core_1.normalize)('/' + path));
|
68 | }
|
69 | visit() { }
|
70 |
|
71 | beginUpdate(path) {
|
72 | throw new exception_1.FileDoesNotExistException(path);
|
73 | }
|
74 | commitUpdate(record) {
|
75 | throw new exception_1.FileDoesNotExistException(record instanceof recorder_1.UpdateRecorderBase ? record.path : '<unknown>');
|
76 | }
|
77 |
|
78 | copy(path, _to) {
|
79 | throw new exception_1.FileDoesNotExistException(path);
|
80 | }
|
81 | delete(path) {
|
82 | throw new exception_1.FileDoesNotExistException(path);
|
83 | }
|
84 | create(path, _content) {
|
85 | throw new CannotCreateFileException(path);
|
86 | }
|
87 | rename(path, _to) {
|
88 | throw new exception_1.FileDoesNotExistException(path);
|
89 | }
|
90 | overwrite(path, _content) {
|
91 | throw new exception_1.FileDoesNotExistException(path);
|
92 | }
|
93 | apply(_action, _strategy) { }
|
94 | get actions() {
|
95 | return [];
|
96 | }
|
97 | }
|
98 | exports.NullTree = NullTree;
|