source: trip-planner-front/node_modules/@angular-devkit/core/node/testing/index.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.5 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 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29exports.TempScopedNodeJsSyncHost = void 0;
30const fs = __importStar(require("fs"));
31const os = __importStar(require("os"));
32const path = __importStar(require("path"));
33const src_1 = require("../../src");
34const host_1 = require("../host");
35/**
36 * A Sync Scoped Host that creates a temporary directory and scope to it.
37 */
38class TempScopedNodeJsSyncHost extends src_1.virtualFs.ScopedHost {
39 constructor() {
40 const root = src_1.normalize(path.join(os.tmpdir(), `devkit-host-${+Date.now()}-${process.pid}`));
41 fs.mkdirSync(src_1.getSystemPath(root));
42 super(new host_1.NodeJsSyncHost(), root);
43 this._root = root;
44 }
45 get files() {
46 const sync = this.sync;
47 function _visit(p) {
48 return sync
49 .list(p)
50 .map((fragment) => src_1.join(p, fragment))
51 .reduce((files, path) => {
52 if (sync.isDirectory(path)) {
53 return files.concat(_visit(path));
54 }
55 else {
56 return files.concat(path);
57 }
58 }, []);
59 }
60 return _visit(src_1.normalize('/'));
61 }
62 get root() {
63 return this._root;
64 }
65 get sync() {
66 if (!this._sync) {
67 this._sync = new src_1.virtualFs.SyncDelegateHost(this);
68 }
69 return this._sync;
70 }
71}
72exports.TempScopedNodeJsSyncHost = TempScopedNodeJsSyncHost;
Note: See TracBrowser for help on using the repository browser.