UNPKG

6.69 kBJavaScriptView Raw
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.ResolverHost = void 0;
11/**
12 * A Host that runs a method before calling its delegate. This is an abstract class and its actual
13 * behaviour is entirely dependant of the subclass.
14 */
15class ResolverHost {
16 constructor(_delegate) {
17 this._delegate = _delegate;
18 }
19 get capabilities() {
20 return this._delegate.capabilities;
21 }
22 write(path, content) {
23 return this._delegate.write(this._resolve(path), content);
24 }
25 read(path) {
26 return this._delegate.read(this._resolve(path));
27 }
28 delete(path) {
29 return this._delegate.delete(this._resolve(path));
30 }
31 rename(from, to) {
32 return this._delegate.rename(this._resolve(from), this._resolve(to));
33 }
34 list(path) {
35 return this._delegate.list(this._resolve(path));
36 }
37 exists(path) {
38 return this._delegate.exists(this._resolve(path));
39 }
40 isDirectory(path) {
41 return this._delegate.isDirectory(this._resolve(path));
42 }
43 isFile(path) {
44 return this._delegate.isFile(this._resolve(path));
45 }
46 // Some hosts may not support stat.
47 stat(path) {
48 return this._delegate.stat(this._resolve(path));
49 }
50 // Some hosts may not support watching.
51 watch(path, options) {
52 return this._delegate.watch(this._resolve(path), options);
53 }
54}
55exports.ResolverHost = ResolverHost;
56//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9hbmd1bGFyX2RldmtpdC9jb3JlL3NyYy92aXJ0dWFsLWZzL2hvc3QvcmVzb2x2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBYUg7OztHQUdHO0FBQ0gsTUFBc0IsWUFBWTtJQUdoQyxZQUFzQixT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