source: trip-planner-front/node_modules/@angular-devkit/schematics/src/tree/null.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.6 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.NullTree = exports.NullTreeDirEntry = exports.CannotCreateFileException = void 0;
11const core_1 = require("@angular-devkit/core");
12const exception_1 = require("../exception/exception");
13const interface_1 = require("./interface");
14const recorder_1 = require("./recorder");
15class CannotCreateFileException extends core_1.BaseException {
16 constructor(path) {
17 super(`Cannot create file "${path}".`);
18 }
19}
20exports.CannotCreateFileException = CannotCreateFileException;
21class 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(core_1.dirname(this.path));
29 }
30 dir(name) {
31 return new NullTreeDirEntry(core_1.join(this.path, name));
32 }
33 file(_name) {
34 return null;
35 }
36 visit() { }
37}
38exports.NullTreeDirEntry = NullTreeDirEntry;
39class NullTree {
40 constructor() {
41 this.root = new NullTreeDirEntry(core_1.normalize('/'));
42 }
43 [interface_1.TreeSymbol]() {
44 return this;
45 }
46 branch() {
47 return new NullTree();
48 }
49 merge(_other, _strategy) { }
50 // Simple readonly file system operations.
51 exists(_path) {
52 return false;
53 }
54 read(_path) {
55 return null;
56 }
57 get(_path) {
58 return null;
59 }
60 getDir(path) {
61 return new NullTreeDirEntry(core_1.normalize('/' + path));
62 }
63 visit() { }
64 // Change content of host files.
65 beginUpdate(path) {
66 throw new exception_1.FileDoesNotExistException(path);
67 }
68 commitUpdate(record) {
69 throw new exception_1.FileDoesNotExistException(record instanceof recorder_1.UpdateRecorderBase ? record.path : '<unknown>');
70 }
71 // Change structure of the host.
72 copy(path, _to) {
73 throw new exception_1.FileDoesNotExistException(path);
74 }
75 delete(path) {
76 throw new exception_1.FileDoesNotExistException(path);
77 }
78 create(path, _content) {
79 throw new CannotCreateFileException(path);
80 }
81 rename(path, _to) {
82 throw new exception_1.FileDoesNotExistException(path);
83 }
84 overwrite(path, _content) {
85 throw new exception_1.FileDoesNotExistException(path);
86 }
87 apply(_action, _strategy) { }
88 get actions() {
89 return [];
90 }
91}
92exports.NullTree = NullTree;
Note: See TracBrowser for help on using the repository browser.