source: trip-planner-front/node_modules/@schematics/angular/migrations/update-9/utils.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 1.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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.forwardSlashPath = exports.isIvyEnabled = void 0;
11const core_1 = require("@angular-devkit/core");
12const json_file_1 = require("../../utility/json-file");
13function isIvyEnabled(tree, tsConfigPath) {
14 // In version 9, Ivy is turned on by default
15 // Ivy is opted out only when 'enableIvy' is set to false.
16 let tsconfigJson;
17 try {
18 tsconfigJson = new json_file_1.JSONFile(tree, tsConfigPath);
19 }
20 catch {
21 return true;
22 }
23 const enableIvy = tsconfigJson.get(['angularCompilerOptions', 'enableIvy']);
24 if (enableIvy !== undefined) {
25 return !!enableIvy;
26 }
27 const configExtends = tsconfigJson.get(['extends']);
28 if (configExtends && typeof configExtends === 'string') {
29 const extendedTsConfigPath = core_1.resolve(core_1.dirname(core_1.normalize(tsConfigPath)), core_1.normalize(configExtends));
30 return isIvyEnabled(tree, extendedTsConfigPath);
31 }
32 return true;
33}
34exports.isIvyEnabled = isIvyEnabled;
35// TS represents paths internally with '/' and expects paths to be in this format.
36// angular.json expects paths with '/', but doesn't enforce them.
37function forwardSlashPath(path) {
38 return path.replace(/\\/g, '/');
39}
40exports.forwardSlashPath = forwardSlashPath;
Note: See TracBrowser for help on using the repository browser.