[6a3a178] | 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 | */
|
---|
| 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(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 | }
|
---|
| 38 | exports.NullTreeDirEntry = NullTreeDirEntry;
|
---|
| 39 | class 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 | }
|
---|
| 92 | exports.NullTree = NullTree;
|
---|