source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/utils/read-tsconfig.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.1 KB
RevLine 
[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 */
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.readTsconfig = void 0;
30const path = __importStar(require("path"));
31/**
32 * Reads and parses a given TsConfig file.
33 *
34 * @param tsconfigPath - An absolute or relative path from 'workspaceRoot' of the tsconfig file.
35 * @param workspaceRoot - workspaceRoot root location when provided
36 * it will resolve 'tsconfigPath' from this path.
37 */
38function readTsconfig(tsconfigPath, workspaceRoot) {
39 const tsConfigFullPath = workspaceRoot ? path.resolve(workspaceRoot, tsconfigPath) : tsconfigPath;
40 // We use 'ng' instead of 'ts' here because 'ts' is not aware of 'angularCompilerOptions'
41 // and will not merged them if they are at un upper level tsconfig file when using `extends`.
42 const ng = require('@angular/compiler-cli');
43 const configResult = ng.readConfiguration(tsConfigFullPath);
44 if (configResult.errors && configResult.errors.length) {
45 throw new Error(ng.formatDiagnostics(configResult.errors));
46 }
47 return configResult;
48}
49exports.readTsconfig = readTsconfig;
Note: See TracBrowser for help on using the repository browser.