source: trip-planner-front/node_modules/@angular/cdk/schematics/utils/project-tsconfig-paths.mjs@ fa375fe

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

initial commit

  • Property mode set to 100644
File size: 6.1 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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11 return new (P || (P = Promise))(function (resolve, reject) {
12 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15 step((generator = generator.apply(thisArg, _arguments || [])).next());
16 });
17};
18Object.defineProperty(exports, "__esModule", { value: true });
19exports.getWorkspaceConfigGracefully = exports.getTargetTsconfigPath = void 0;
20const core_1 = require("@angular-devkit/core");
21const reader_1 = require("@angular-devkit/core/src/workspace/json/reader");
22/** Name of the default Angular CLI workspace configuration files. */
23const defaultWorkspaceConfigPaths = ['/angular.json', '/.angular.json'];
24/** Gets the tsconfig path from the given target within the specified project. */
25function getTargetTsconfigPath(project, targetName) {
26 var _a, _b, _c;
27 const tsconfig = (_c = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.get(targetName)) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.tsConfig;
28 return tsconfig ? core_1.normalize(tsconfig) : null;
29}
30exports.getTargetTsconfigPath = getTargetTsconfigPath;
31/** Resolve the workspace configuration of the specified tree gracefully. */
32function getWorkspaceConfigGracefully(tree) {
33 return __awaiter(this, void 0, void 0, function* () {
34 const path = defaultWorkspaceConfigPaths.find(filePath => tree.exists(filePath));
35 const configBuffer = tree.read(path);
36 if (!path || !configBuffer) {
37 return null;
38 }
39 try {
40 return yield reader_1.readJsonWorkspace(path, {
41 readFile: (filePath) => __awaiter(this, void 0, void 0, function* () { return tree.read(filePath).toString(); })
42 });
43 }
44 catch (e) {
45 return null;
46 }
47 });
48}
49exports.getWorkspaceConfigGracefully = getWorkspaceConfigGracefully;
50//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdC10c2NvbmZpZy1wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvc2NoZW1hdGljcy91dGlscy9wcm9qZWN0LXRzY29uZmlnLXBhdGhzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7OztBQUVILCtDQUErQztBQU0vQywyRUFBaUY7QUFJakYscUVBQXFFO0FBQ3JFLE1BQU0sMkJBQTJCLEdBQUcsQ0FBQyxlQUFlLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztBQUV4RSxpRkFBaUY7QUFDakYsU0FBZ0IscUJBQXFCLENBQUMsT0FBMEIsRUFDMUIsVUFBa0I7O0lBQ3RELE1BQU0sUUFBUSxHQUFHLE1BQUEsTUFBQSxNQUFBLE9BQU8sQ0FBQyxPQUFPLDBDQUFFLEdBQUcsQ0FBQyxVQUFVLENBQUMsMENBQUUsT0FBTywwQ0FBRSxRQUFRLENBQUM7SUFDckUsT0FBTyxRQUFRLENBQUMsQ0FBQyxDQUFDLGdCQUFTLENBQUMsUUFBa0IsQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUM7QUFDekQsQ0FBQztBQUpELHNEQUlDO0FBRUQsNEVBQTRFO0FBQzVFLFNBQXNCLDRCQUE0QixDQUFDLElBQVU7O1FBQzNELE1BQU0sSUFBSSxHQUFHLDJCQUEyQixDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsRU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ydCBhc3luYyBmdW5jdGlvbiBnZXRXb3Jrc3BhY2VDb25maWdHcmFjZWZ1bGx5KHRyZWU6IFRyZWUpOiBQcm9taXNlPFdvcmtzcGFjZURlZmluaXRpb258bnVsbD4ge1xuICBjb25zdCBwYXRoID0gZGVmYXVsdFdvcmtzcGFjZUNvbmZpZ1BhdGhzLmZpbmQoZmlsZVBhdGggPT4gdHJlZS5leGlzdHMoZmlsZVBhdGgpKTtcbiAgY29uc3QgY29uZmlnQnVmZmVyID0gdHJlZS5yZWFkKHBhdGghKTtcblxuICBpZiAoIXBhdGggfHwgIWNvbmZpZ0J1ZmZlcikge1xuICAgIHJldHVybiBudWxsO1xuICB9XG5cbiAgdHJ5IHtcbiAgICByZXR1cm4gYXdhaXQgcmVhZEpzb25Xb3Jrc3BhY2UocGF0aCwge1xuICAgICAgcmVhZEZpbGU6IGFzeW5jIGZpbGVQYXRoID0+IHRyZWUucmVhZChmaWxlUGF0aCkhLnRvU3RyaW5nKClcbiAgICB9IGFzIFdvcmtzcGFjZUhvc3QpO1xuICB9IGNhdGNoIChlKSB7XG4gICAgcmV0dXJuIG51bGw7XG4gIH1cbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.